Exemplo n.º 1
0
 /**
  * Here is where users can request to remove their accounts.
  *
  * Only non-administrator users can be canceled this way. User may request to
  * cancel their accounts by using the form rendered by this action, an e-mail
  * will be send with a especial link which will remove the account.
  *
  * @return void Redirects to previous page
  */
 public function cancelRequest()
 {
     $user = user();
     $this->loadModel('User.Users');
     $user = $this->Users->get($user->id);
     $emailSent = NotificationManager::cancelRequest($user)->send();
     if ($emailSent) {
         $this->Flash->success(__d('user', 'Further instructions have been sent to your e-mail address.'));
     } else {
         $this->Flash->warning(__d('user', 'Instructions could not been sent to your e-mail address, please try again later.'));
     }
     $this->title(__d('user', 'Account Cancellation'));
     $this->redirect($this->referer());
 }
 /**
  * test __callStatic() for cancelRequest().
  *
  * @return void
  */
 public function testCallStaticCancelRequest()
 {
     $user = new User();
     $cancelRequestMessage = NotificationManager::cancelRequest($user);
     $this->assertInstanceOf('User\\Notification\\Message\\CancelRequestMessage', $cancelRequestMessage);
 }