Verify the email address for the given token.

@param  \LaravelVerifyEmails\Contracts\Auth\CanVerifyEmail  $user
@param  string  $token
@return mixed
187975
public function verify(CanVerifyEmailContract $user, $token)
    {
        // If the responses from the validate method is not a user instance, we will
        // assume that it is a redirect and simply return it from this method and
        // the user is properly redirected having an error message on the post.
        $user = $this->validateVerification($user, $token);

        if (! $user instanceof CanVerifyEmailContract) {
            return $user;
        }

        $this->tokens->delete($token);

        $user->setVerified(true);

        $user->save();

        return VerifyEmailBrokerContract::EMAIL_VERIFIED;
    }
527377
public function authenticated(Request $request, Contracts\RequiresEmailVerification $user)
    {
        if (config('verification.verify') && !$user->isUserEmailVerified()) {
            Auth::guard($this->getGuard())->logout();

            return redirect($this->verificationRedirectPath());
        }

        return redirect()->intended($this->redirectPath());
    }
1227776
protected function deleteExisting(Contracts\RequiresEmailVerification $user)
    {
        return $this->getTable()->where('email', $user->getEmailForVerification())->delete();
    }
280142
public function afterTokenVerification(Entity $user, $options = []) {
		if ($user->get('token_is_expired') === true) {
			return false;
		}

		if ($options['tokenField'] === $this->_field('emailToken')) {
			$user->set([
				$this->_field('emailVerified') => true,
				$this->_field('emailToken') => null,
				$this->_field('emailTokenExpires') => null
			], [
				'guard' => false
			]);
		}

		return $this->_table->save($user, ['validate' => false]);
	}
743976
public function actionVerifyEmail($token)
    {
        try {
            $model = new VerifyEmailForm($token);
        } catch (InvalidArgumentException $e) {
            throw new BadRequestHttpException($e->getMessage());
        }
        if ($user = $model->verifyEmail()) {
            if (Yii::$app->user->login($user)) {
                Yii::$app->session->setFlash('success', 'Your email has been confirmed!');
                return $this->goHome();
            }
        }

        Yii::$app->session->setFlash('error', 'Sorry, we are unable to verify your account with provided token.');
        return $this->goHome();
    }
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;
    }
1338954
public function verify( $user, $token ) {

		// Check Token
		if( $user->isVerifyTokenValid( $token ) ) {

			$modelClass	= static::$modelClass;

			// Find existing user
			$userToUpdate = $modelClass::findById( $user->id );

			// User need admin approval
			if( Yii::$app->core->isUserApproval() ) {

				$userToUpdate->verify();
			}
			// Direct approval and activation
			else {

				$userToUpdate->status = User::STATUS_ACTIVE;
			}

			$userToUpdate->unsetVerifyToken();

			$userToUpdate->update();

			return true;
		}

		return false;
	}
39821
protected function buildPayload(CanVerifyEmailContract $user, $email, $expiration)
    {
        return implode(';', [
            $email,
            $expiration,
            $user->password,
        ]);
    }
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);
    }
1294490
public function sendVerificationEmail(UserInterface $user)
    {
        $params = [
            'user_id' => $user->id(),
            'type' => UserLink::VERIFY_EMAIL,
        ];

        // delete previous verify links
        $this->getDatabase()
            ->delete('UserLinks')
            ->where($params)
            ->execute();

        // create new verification link
        $link = new UserLink();
        $link->create($params);

        // email it
        return $user->sendEmail('verify-email',
            ['verify' => $link->link]);
    }
772207
public function sendWelcomeMessage(User $user, Token $token = null)
    {
        $mailVars = [
            '{token}' => $token->url,
            '{legal_link}' => Url::toRoute([
                '/legal/default/view',
                'legalId' => Legal::findOne(['key' => 'buyers'])->id,
                'langId' => Language::getCurrent()->id
            ], true)
        ];

        /**
         * @var $mailTemplate Template
         */
        $mailTemplate = \Yii::$app->get('emailTemplates')
            ->getTemplate('welcome', Language::getCurrent()->id);
        $mailTemplate->parseSubject($mailVars);
        $mailTemplate->parseBody($mailVars);

        return \Yii::$app->shopMailer->compose('mail-body', ['bodyContent' => $mailTemplate->getBody()])
            ->setFrom([\Yii::$app->shopMailer->transport->getUsername() => \Yii::$app->name ?? Url::to(['/'], true)])
            ->setTo($user->email)
            ->setSubject($mailTemplate->getSubject())
            ->send();
    }
831972
public function verify($token)
    {
        $user = new User();
        if ($token === 'NULL' || $user->isToken($token) !== true) {
            Error::set(__printl('auth:error:token'), 'token');
        }
        if ($this->fail() !== true) {
            if (!(new User())->isLogin()) {
                $id = $user->getByWhere('token', $token)[0]['id'];
                $email = $user->getByWhere('token', $token)[0]['email'];
                $update = new Update();
                $update->update(['token' => 'NULL'], $id);
                $subject = __printl('auth:subject:verified');
                $link = __config()->auth->verification_link.'/'.$token;
                $html = __printl('auth:body:verified');
                $html = str_replace(':email', $email, $html);
                $email = new EmailHandler($subject, $html, $email);
                Success::set(__config()->auth->success->verified);
            } else {
                Error::set(__printl('auth:error:already:login'), 'login');
            }
        }
    }
43629
public function index($token, $email)
    {
        // Validate token
        $verificationToken = $this->emailVerificationRepository->getByUnexpiredToken($token);

        if (empty($verificationToken)) {
            return view('nodes.api::email-verification.invalid');
        }

        // Validate e-mail address
        if ($verificationToken->email != $email) {
            return view('nodes.api::email-verification.invalid');
        }

        // All good! Update user's password
        $status = $this->emailVerificationRepository->updateVerificationByEmail($verificationToken->email);
        if (empty($status)) {
            return view('nodes.api::email-verification.invalid')->with(['email' => $verificationToken->email, 'error' => 'Couldn\'t verify the user. Please contact administrator']);
        }

        // Mark token as used
        $verificationToken->markAsUsed();

        return view('nodes.api::email-verification.done')->with('success', 'User was successfully verified');
    }
606843
public function exists(CanResetPasswordContract $user, $token)
    {
        $record = (array) $this->getTable()->where(
            'email', $user->getEmailForPasswordReset()
        )->first();

        return $record &&
               ! $this->tokenExpired($record['created_at']) &&
                 $this->hasher->check($token, $record['token']);
    }
756245
public static function findByEmailToken($token)
    {
        if (!static::isEmailTokenValid($token)) {
            return null;
        }
        return static::find()->where(['email_token' => $token, 'status' => self::STATUS_ACTIVE])->limit(1)->one();
    }
961606
public function verifyRegistration(TokenEntity $token)
    {
        if ($token->isNew()) {
            throw new OutOfBoundsException('NOT_FOUND', self::TOKEN_NOT_FOUND);
        }

        if ((int) $token->getTokenTypeId() !== TokenEntity::TYPE_VERIFY_REGISTRATION) {
            throw new OutOfBoundsException('NOT_FOUND', self::INCORRECT_TOKEN_TYPE);
        }

        if ($token->getExpires() < time()) {
            throw new OutOfBoundsException('EXPIRED', self::TOKEN_EXPIRED);
        }

        $user = $this->findById($token->getUserId());

        // Token looks good; verify user and delete the token
        $user->setVerified(true);

        $this->userMapper->persist($user);

        $this->tokenMapper->delete($token);

        return $user;
    }
1279955
public static function verify($token, $provider, $musked)
  {
    $userToken = MagicLink::where('token', $token)->first();

    if ($userToken == null) return false;
    $userEmail = $userToken->email;

    if ($userToken->created_at->diffInMinutes() <= config('auth.expire.magic_token')) {
      if (Session::has('_magic')) {
        if (Session::key('_magic') == $userToken->token) {
          $userToken->delete();
          Session::delete('_magic');
          return config("auth.provider.{$provider}.model")::where($musked, $userEmail)->first();
        }
        else {
          Session::delete('_magic');
          return false;
        }
      }
    }

    $userToken->delete();
    return false;
  }