Verifies the given user's email.

@param \Illuminate\Http\Request|Request $request
@param EmailVerification $emailVerification
@return \Illuminate\Http\RedirectResponse
335407
public function verify(Request $request, EmailVerification $emailVerification)
    {
        $this->validateVerificationRequest($request);
        
        // Here we will attempt to verify the user. If it is successful we
        // will update the verified on an actual user model and persist it to the
        // database. Otherwise we will parse the error and return the response.
        $response = $emailVerification->verify(
            $request->only(
                'email', 'expiration', 'token'
            ), function ($user) {
            return $this->verifiedEmail($user);
        }
        );


        // If the user was successfully verified, we will redirect the user back to
        // the application's home authenticated view. If there is an error we can
        // redirect them back to where they came from with their error message.
        return $response == EmailVerification::VERIFIED
            ? $this->sendVerificationResponse($response)
            : $this->sendVerificationFailedResponse($request, $response);
    }
440434
public function loginWithEmail(Request $request)
  {
    $request->rules = [
      'email' => 'required'
    ];

    $request->validate();

    $provider = $this->provider;

    $info = MagicLink::notify($request, $provider, $this->musk());

    $this->sendMagicLinkNotification($info['email'], $info['token']);
    $this->redirectUser($request->input('email'));
  }
66794
protected function convertValidationExceptionToResponse(ValidationException $e, Request $request)
    {
        if ($e->response) {
            return $e->response;
        }

        $errors = $e->validator->errors()->getMessages();

        if ($request->ajax() || $request->wantsJson()) {
            return Response::json($errors, 422);
        }

        return Redirect::back()->withInput($request->input())->withErrors($errors);
    }
1280765
function (form) {
            var options = {
              login: form.data.email
            };

            if (req.organization) {
              options.accountStore = {
                href: req.organization.href
              };
            }

            application.resendVerificationEmail(options, function (err, account) {
              // Code 2016 means that an account does not exist for the given email
              // address.  We don't want to leak information about the account
              // list, so allow this continue without error.
              if (err && err.code !== 2016) {
                logger.info('A user tried to resend their account verification email, but failed: ' + err.message);
                return helpers.render(req, res, view, { error: err.message, form: form });
              }

              if (account) {
                emailVerificationHandler(new Account(account));
              }

              res.redirect(config.web.login.uri + '?status=unverified');
            });
          }
1324293
public function redirectVerified($code, $destination = null, $parameters = []): void
    {
        // first parameter is optional
        if (!is_numeric($code)) {
            $parameters = is_array($destination) ? $destination : array_slice(func_get_args(), 1);
            $destination = $code;
            $code = null;
        } elseif (!is_array($parameters)) {
            $parameters = array_slice(func_get_args(), 2);
        }

        /** @var Presenter $presenter */
        $presenter = $this->getPresenter();
        $link = $presenter->createRequest($this, $destination, $parameters, 'redirect');
        if ($presenter->getVerifier()->isLinkVerified($presenter->getLastCreatedRequest(), $this)) {
            $presenter->redirectUrl($link, $code);
        }
    }
673121
public function verify(ServerRequestInterface $request, Tree $tree, UserService $user_service): ResponseInterface
    {
        $username = $request->get('username', '');
        $token    = $request->get('token', '');

        $title = I18N::translate('User verification');

        $user = $user_service->findByUserName($username);

        if ($user instanceof User && $user->getPreference('reg_hashcode') === $token) {
            // switch language to webmaster settings
            $webmaster = $user_service->find((int) $tree->getPreference('WEBMASTER_USER_ID'));

            if ($webmaster instanceof User) {
                I18N::init($webmaster->getPreference('language'));

                /* I18N: %s is a server name/URL */
                $subject = I18N::translate('New user at %s', WT_BASE_URL . ' ' . $tree->title());

                Mail::send(
                    new TreeUser($tree),
                    $webmaster,
                    new TreeUser($tree),
                    $subject,
                    view('emails/verify-notify-text', ['user' => $user]),
                    view('emails/verify-notify-html', ['user' => $user])
                );

                $mail1_method = $webmaster->getPreference('CONTACT_METHOD');

                if ($mail1_method !== 'messaging3' && $mail1_method !== 'mailto' && $mail1_method !== 'none') {
                    DB::table('message')->insert([
                        'sender'     => $username,
                        'ip_address' => $request->getClientIp(),
                        'user_id'    => $webmaster->id(),
                        'subject'    => $subject,
                        'body'       => view('emails/verify-notify-text', ['user' => $user]),
                    ]);
                }
                I18N::init(WT_LOCALE);
            }

            $user
                ->setPreference('verified', '1')
                ->setPreference('reg_timestamp', date('U'))
                ->setPreference('reg_hashcode', '');

            Log::addAuthenticationLog('User ' . $username . ' verified their email address');

            return $this->viewResponse('verify-success-page', [
                'title' => $title,
            ]);
        }

        return $this->viewResponse('verify-failure-page', [
            'title' => $title,
        ]);
    }
780025
public function verify($id)
    {
        if (!$this->request->is(['get', 'post', 'put'])) {
            throw new MethodNotAllowedException();
        }

        /** @var User $user */
        $user = $this->Users->get($id);

        if ($this->request->is(['post', 'put'])) {
            if ($user->verified) {
                $this->Flash->warning(__d('wasabi_core', 'The email address of user <strong>{0}</strong> is already verified.', $user->username));
                $this->redirect($this->Filter->getBacklink(['action' => 'index'], $this->request));
                return;
            }
            if ($this->Users->verify($user, true)) {
                $this->getMailer('Wasabi/Core.User')->send('verifiedByAdminEmail', [$user]);
                $this->Flash->success(__d('wasabi_core', 'The email address of user <strong>{0}</strong> has been verified.', $user->username));
                $this->redirect($this->Filter->getBacklink(['action' => 'index'], $this->request));
                return;
            } else {
                $this->Flash->error($this->dbErrorMessage);
            }
        }

        $this->set([
            'user' => $user
        ]);
    }
876610
public function updateVerificationByEmail($email)
    {
        // Retrieve user by e-mail
        $user = $this->authModel->where('email', '=', $email)->first();
        if (empty($user)) {
            return false;
        }

        // Update user with a timestamp of when he/her was verified
        return (bool) $user->fill([
            'is_verified' => 1,
            'verified_at' => Carbon::now(),
        ])->save();
    }
144911
public function withVerifiedEmail($email)
    {
        $request = clone $this;
        $request->email = $email instanceof Email ? $email : new Email($email);
        $request->emailIsVerified = true;

        return $request;
    }
1246997
public function verifyRequest(Request $request = null)
    {
        $request = $request ?: $this->request;
        $response = $request->request->get('g-recaptcha-response');
        $remoteip = $request->getClientIp();

        return $this->verify($response, $remoteip);
    }
1054734
public function verifyRequest(): void
    {
        $type = $this->request->getParameter('type');
        $object = $this->request->getParameter('object');

        if ($type === null || $type !== 'message_new') {
            throw new InvalidRequest('Invalid type');
        }

        if ($object === null) {
            throw new InvalidRequest('Invalid object');
        }

        if (!isset($object['user_id'])) {
            throw new InvalidRequest('Invalid user_id');
        }

        if (!isset($object['body'])) {
            throw new InvalidRequest('Invalid body');
        }
    }
1074079
public function authenticate(Request $request)
    {
        $email    = $request->input(self::AUTH_PARAM_EMAIL, null);
        $password = $request->input(self::AUTH_PARAM_PASSWORD, null);

        if ($email !== null &&
            $password !== null &&
            ($user = User::query()->where(User::FIELD_EMAIL, '=', strtolower($email))->first()) !== null
        ) {
            /** @var HasherInterface $hasher */
            $hasher = app(HasherInterface::class);
            if ($hasher->check($password, $user->{User::FIELD_PASSWORD_HASH}) === true) {
                /** @var TokenCodecInterface $codec */
                $codec = app(TokenCodecInterface::class);
                $token = $codec->encode($user);

                $this->getLogger()->debug(
                    'Account login success.',
                    [User::FIELD_EMAIL => $email, User::FIELD_ID => $user->getKey()]
                );

                return response($token);
            }
        }

        $this->getLogger()->debug('Account login failed.', [User::FIELD_EMAIL => $email]);

        return response(null, Response::HTTP_UNAUTHORIZED);
    }
750476
def get(self, request, key):
        """"""

        try:
            email_val = EmailAddressValidation.objects.get(validation_key=key)
        except EmailAddressValidation.DoesNotExist:
            messages.error(request, _('The email address you are trying to '
                                      'verify either has already been verified'
                                      ' or does not exist.'))
            return redirect('/')

        try:
            email = EmailAddress.objects.get(address=email_val.address)
        except EmailAddress.DoesNotExist:
            email = EmailAddress(address=email_val.address)

        if email.user and email.user.is_active:
            messages.error(request, _('The email address you are trying to '
                                      'verify is already an active email '
                                      'address.'))
            email_val.delete()
            return redirect('/')

        email.user = email_val.user
        email.save()
        email_val.delete()

        user = User.objects.get(username=email.user.username)
        user.is_active = True
        user.save()

        messages.success(request, _('Email address verified!'))
        return redirect('user_profile', username=email_val.user.username)
354864
public function postRegister(Request $request)
    {
        $this->validate($request, $this->validateCreating());

        $user = $this->create($request->all());
        if (config('taki.confirm_after_created')) {
            $token              = app('auth.password.tokens')->createNewToken();
            $user->is_activated = 0;
            $user->token        = $token;
            $user->save();
            Mail::queue(config('taki.emails.activate'), compact('token', 'user'), function ($m) use ($user, $token) {
                $m->subject(config('taki.emails.activate_subject'));
                $m->to($user->getEmailForPasswordReset());
            });
        } else {
            Auth::login($user);
        }

        if (method_exists($this, 'userRegistered')) {
            $this->userRegistered($request, $user);
        }


        return redirect($this->getPostRegisterRedirectPath());
    }
916816
public static function validate($email)
    {
        $validate = new Email();
        foreach ($validate->getFilters() as $filter) {
            $v = $validate->{'check' . ucfirst($filter)}($email);
            if ($v) {
                $validate->setValid(true);
            } else {
                $validate->setValid(false);
                break;
            }
        }

        return $validate->isValid();
    }
624941
public function sendVerificationLink(CanVerifyEmailContract $user, Closure $callback = null)
    {
        // Once we have the verify token, we are ready to send the message out to this
        // user with a link to verify their email. We will then redirect back to
        // the current URI having nothing set in the session to indicate errors.
        $token = $this->tokens->create($user);

        $this->emailVerificationLink($user, $token, $callback);

        return VerifyEmailBrokerContract::VERIFY_LINK_SENT;
    }
897336
public function verifyEmail($requireVerifiedEmail = false)
    {
        if ($this->email_verified) {
            return true;
        }
        $this->email_verified = 1;
        if ($requireVerifiedEmail && !$this->is_active) {
            $this->is_active = 1;
        }

        return $this->save(false);
    }