Example #1
0
 /**
  * Executes registerUser method in UserManager which
  * attempt to register a new user via pulbic register form.
  *
  * @param  array  $input
  * @return Response
  */
 public function requestRegister($input)
 {
     if ($user = $this->UserManager->registerUser($input)) {
         $this->SessionsRepository->sendActivationEmail($user);
         return $this->Redirect->route('dvs-user-register')->with('message-success', $this->SessionsRepository->message);
     }
     return $this->Redirect->route('dvs-user-register')->withInput()->withErrors($this->UserManager->errors)->with('message-errors', $this->UserManager->message);
 }
Example #2
0
 /**
  * Process user activation request.
  *
  * @param  integer  $userId
  * @param  string   $activateCode
  * @return False | DeviseUser
  */
 public function activate($userId, $activateCode)
 {
     $user = $this->UsersRepository->findById($userId);
     if ($activateCode === $user->activate_code) {
         $this->UserManager->activate($user);
         // activate the user
         $this->Auth->login($user);
         // auto-login newly activated user
         $this->message = 'Account successfully activated.';
         return true;
     }
     $this->message = 'Issues occurred while attempting to activate account. Please contact support.';
     return false;
 }