/** * @Request({"user", "key"}) */ public function activateAction($username, $activation) { $message = ''; if (empty($username) || empty($activation) || !($user = User::where(['username' => $username, 'activation' => $activation, 'status' => User::STATUS_BLOCKED, 'login IS NULL'])->first())) { return AuthController::messageView(['message' => __('Invalid key.'), 'success' => false]); } if ($admin = $this->module->config('registration') == 'approval' and !$user->get('verified')) { $user->activation = App::get('auth.random')->generateString(32); $this->sendApproveMail($user); $message = __('Your email has been verified. Once an administrator approves your account, you will be notified by email.'); } else { $user->set('verified', true); $user->status = User::STATUS_ACTIVE; $user->activation = ''; $this->sendWelcomeEmail($user); if ($admin) { $message = __('The user\'s account has been activated and the user has been notified about it.'); } else { $message = __('Your account has been activated.'); } } $user->save(); App::message()->success($message); return App::redirect('@user/login'); }
protected function messageView($message, $success = true) { return AuthController::messageView(['title' => __('Reset password'), 'message' => $message, 'success' => $success]); }