@@ -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 ' ));
0 commit comments