app\main\controllers\AuthController::activateUser PHP Méthode

activateUser() public méthode

GET | This activates a user record to be able to login.
public activateUser ( $token ) : mixed
Résultat mixed
    public function activateUser($token)
    {
        $user = User::find(['token = :token: AND activated = :activated:', 'bind' => ['token' => $token, 'activated' => false]])->getFirst();
        if (!$user) {
            flash()->session()->warning('We cant find your request, please ' . 'try again, or contact us.');
            return view('errors.404');
        }
        $user->setActivated(true);
        if ($user->save() === false) {
            foreach ($user->getMessages() as $message) {
                flash()->session()->error($message);
            }
        } else {
            flash()->session()->success('You have successfully activated your account, ' . 'you are now allowed to login.');
        }
        return redirect()->to(route('showLoginForm'));
    }