+ auth()->login($newUser);
+ session()->flash('success', 'Thanks for signing up! You are now registered and signed in.');
+ return redirect($this->redirectPath());
+ }
+
+ /**
+ * Show the page to tell the user to check their email
+ * and confirm their address.
+ */
+ public function getRegisterConfirmation()
+ {
+ return view('auth/register-confirm');
+ }
+
+ /**
+ * View the confirmation email as a standard web page.
+ * @param $token
+ * @return \Illuminate\View\View
+ * @throws UserRegistrationException
+ */
+ public function viewConfirmEmail($token)
+ {
+ $confirmation = $this->emailConfirmationService->getEmailConfirmationFromToken($token);
+ return view('emails/email-confirmation', ['token' => $confirmation->token]);
+ }
+
+ /**
+ * Confirms an email via a token and logs the user into the system.
+ * @param $token
+ * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
+ * @throws UserRegistrationException
+ */
+ public function confirmEmail($token)
+ {
+ $confirmation = $this->emailConfirmationService->getEmailConfirmationFromToken($token);
+ $user = $confirmation->user;
+ $user->email_confirmed = true;
+ $user->save();
+ auth()->login($confirmation->user);
+ session()->flash('success', 'Your email has been confirmed!');
+ $this->emailConfirmationService->deleteConfirmationsByUser($user);