user_service = $user_service; } public function showVerificationForm() { return view('auth.email_verification'); } /** * @param string $token * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function verify($token) { try { $user = $this->user_service->verifyEmail($token); return view('auth.email_verification_success', ['user' => $user]); } catch (EntityNotFoundException $ex){ Log::warning($ex); } catch (ValidationException $ex){ Log::warning($ex); } catch (\Exception $ex){ Log::error($ex); } return view('auth.email_verification_error'); } /** * Get a validator for an incoming registration request. * * @param array $data * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) { return Validator::make($data, [ 'email' => 'required|string|email|max:255', 'g-recaptcha-response' => 'required|recaptcha', ]); } public function resend(LaravelRequest $request) { try { $payload = $request->all(); $validator = $this->validator($payload); if (!$validator->passes()) { return Redirect::action('Auth\EmailVerificationController@showVerificationForm')->withErrors($validator); } $user = $this->user_service->resendVerificationEmail($payload); return view("auth.email_verification_resend_success", ['user' => $user]); } catch (EntityNotFoundException $ex){ Log::warning($ex); } catch (ValidationException $ex){ Log::warning($ex); foreach ($ex->getMessages() as $message){ $validator->getMessageBag()->add('validation', $message); } return Redirect::action('Auth\EmailVerificationController@showVerificationForm')->withErrors($validator); } catch(\Exception $ex){ Log::error($ex); } return view("auth.email_verification_error"); } }