Skip to content

Commit fc13e56

Browse files
committed
Merge branch 'development' into release
2 parents 77fc37a + f937bf3 commit fc13e56

File tree

88 files changed

+486
-217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+486
-217
lines changed

.github/translators.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ Taygun Yıldırım (yildirimtaygun) :: Turkish
347347
robing29 :: German
348348
Bruno Eduardo de Jesus Barroso (brunoejb) :: Portuguese, Brazilian
349349
Igor V Belousov (biv) :: Russian
350-
David Bauer (davbauer) :: German
350+
David Bauer (davbauer) :: German; German Informal
351351
Guttorm Hveem (guttormhveem) :: Norwegian Nynorsk; Norwegian Bokmal
352352
Minh Giang Truong (minhgiang1204) :: Vietnamese
353353
Ioannis Ioannides (i.ioannides) :: Greek
@@ -389,7 +389,7 @@ Marc Hagen (MarcHagen) :: Dutch
389389
Kasper Alsøe (zeonos) :: Danish
390390
sultani :: Persian
391391
renge :: Korean
392-
Tim (thegatesdev) :: Dutch; German Informal; Romanian; French; Catalan; Czech; Danish; German; Finnish; Hungarian; Italian; Japanese; Korean; Polish; Russian; Ukrainian; Chinese Simplified; Chinese Traditional; Portuguese, Brazilian; Persian; Spanish, Argentina; Croatian; Norwegian Nynorsk; Estonian; Uzbek; Norwegian Bokmal
392+
Tim (thegatesdev) :: Dutch; German Informal; French; Romanian; Catalan; Czech; Danish; German; Finnish; Hungarian; Italian; Japanese; Korean; Polish; Russian; Ukrainian; Chinese Simplified; Chinese Traditional; Portuguese, Brazilian; Persian; Spanish, Argentina; Croatian; Norwegian Nynorsk; Estonian; Uzbek; Norwegian Bokmal
393393
Irdi (irdiOL) :: Albanian
394394
KateBarber :: Welsh
395395
Twister (theuncles75) :: Hebrew
@@ -422,3 +422,6 @@ crow_ :: Latvian
422422
JocelynDelalande :: French
423423
Jan (JW-CH) :: German Informal
424424
Timo B (lommes) :: German Informal
425+
Erik Lundstedt (Erik.Lundstedt) :: Swedish
426+
yngams (younessmouhid) :: Arabic
427+
Ohadp :: Hebrew

app/Access/Controllers/ConfirmEmailController.php

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@ public function show()
3232

3333
/**
3434
* Shows a notice that a user's email address has not been confirmed,
35-
* Also has the option to re-send the confirmation email.
35+
* along with the option to re-send the confirmation email.
3636
*/
3737
public function showAwaiting()
3838
{
3939
$user = $this->loginService->getLastLoginAttemptUser();
40+
if ($user === null) {
41+
$this->showErrorNotification(trans('errors.login_user_not_found'));
42+
return redirect('/login');
43+
}
4044

41-
return view('auth.user-unconfirmed', ['user' => $user]);
45+
return view('auth.register-confirm-awaiting');
4246
}
4347

4448
/**
@@ -90,19 +94,24 @@ public function confirm(Request $request)
9094
/**
9195
* Resend the confirmation email.
9296
*/
93-
public function resend(Request $request)
97+
public function resend()
9498
{
95-
$this->validate($request, [
96-
'email' => ['required', 'email', 'exists:users,email'],
97-
]);
98-
$user = $this->userRepo->getByEmail($request->get('email'));
99+
$user = $this->loginService->getLastLoginAttemptUser();
100+
if ($user === null) {
101+
$this->showErrorNotification(trans('errors.login_user_not_found'));
102+
return redirect('/login');
103+
}
99104

100105
try {
101106
$this->emailConfirmationService->sendConfirmation($user);
107+
} catch (ConfirmationEmailException $e) {
108+
$this->showErrorNotification($e->getMessage());
109+
110+
return redirect('/login');
102111
} catch (Exception $e) {
103112
$this->showErrorNotification(trans('auth.email_confirm_send_error'));
104113

105-
return redirect('/register/confirm');
114+
return redirect('/register/awaiting');
106115
}
107116

108117
$this->showSuccessNotification(trans('auth.email_confirm_resent'));

app/Access/Controllers/ForgotPasswordController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use BookStack\Http\Controller;
77
use Illuminate\Http\Request;
88
use Illuminate\Support\Facades\Password;
9+
use Illuminate\Support\Sleep;
910

1011
class ForgotPasswordController extends Controller
1112
{
@@ -32,6 +33,10 @@ public function sendResetLinkEmail(Request $request)
3233
'email' => ['required', 'email'],
3334
]);
3435

36+
// Add random pause to the response to help avoid time-base sniffing
37+
// of valid resets via slower email send handling.
38+
Sleep::for(random_int(1000, 3000))->milliseconds();
39+
3540
// We will send the password reset link to this user. Once we have attempted
3641
// to send the link, we will examine the response then see the message we
3742
// need to show to the user. Finally, we'll send out a proper response.

app/Access/Controllers/HandlesPartialLogins.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ protected function currentOrLastAttemptedUser(): User
1717
$user = auth()->user() ?? $loginService->getLastLoginAttemptUser();
1818

1919
if (!$user) {
20-
throw new NotFoundException('A user for this action could not be found');
20+
throw new NotFoundException(trans('errors.login_user_not_found'));
2121
}
2222

2323
return $user;

app/Access/Controllers/ResetPasswordController.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@
1515

1616
class ResetPasswordController extends Controller
1717
{
18-
protected LoginService $loginService;
19-
20-
public function __construct(LoginService $loginService)
21-
{
18+
public function __construct(
19+
protected LoginService $loginService
20+
) {
2221
$this->middleware('guest');
2322
$this->middleware('guard:standard');
24-
25-
$this->loginService = $loginService;
2623
}
2724

2825
/**

app/Access/EmailConfirmationService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class EmailConfirmationService extends UserTokenService
1717
*
1818
* @throws ConfirmationEmailException
1919
*/
20-
public function sendConfirmation(User $user)
20+
public function sendConfirmation(User $user): void
2121
{
2222
if ($user->email_confirmed) {
2323
throw new ConfirmationEmailException(trans('errors.email_already_confirmed'), '/login');

app/Activity/Notifications/Messages/BaseActivityNotification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function toArray($notifiable)
4343
protected function buildReasonFooterLine(LocaleDefinition $locale): LinkedMailMessageLine
4444
{
4545
return new LinkedMailMessageLine(
46-
url('/preferences/notifications'),
46+
url('/my-account/notifications'),
4747
$locale->trans('notifications.footer_reason'),
4848
$locale->trans('notifications.footer_reason_link'),
4949
);

app/App/Providers/RouteServiceProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,9 @@ protected function configureRateLimiting(): void
8181
RateLimiter::for('api', function (Request $request) {
8282
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
8383
});
84+
85+
RateLimiter::for('public', function (Request $request) {
86+
return Limit::perMinute(10)->by($request->ip());
87+
});
8488
}
8589
}

app/Config/cache.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353

5454
'file' => [
5555
'driver' => 'file',
56-
'path' => storage_path('framework/cache/data'),
57-
'lock_path' => storage_path('framework/cache/data'),
56+
'path' => storage_path('framework/cache'),
57+
'lock_path' => storage_path('framework/cache'),
5858
],
5959

6060
'memcached' => [

app/Exceptions/StoppedAuthenticationException.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,10 @@
99

1010
class StoppedAuthenticationException extends \Exception implements Responsable
1111
{
12-
protected $user;
13-
protected $loginService;
14-
15-
/**
16-
* StoppedAuthenticationException constructor.
17-
*/
18-
public function __construct(User $user, LoginService $loginService)
19-
{
20-
$this->user = $user;
21-
$this->loginService = $loginService;
12+
public function __construct(
13+
protected User $user,
14+
protected LoginService $loginService
15+
) {
2216
parent::__construct();
2317
}
2418

0 commit comments

Comments
 (0)