Пример #1
0
 /**
  * Makes the user an active user in the database, and deletes their activation token
  * @return boolean
  */
 public function save()
 {
     $userId = $this->_meta->user_id;
     $this->_user = Users::model()->findByPk($userId);
     if (!$this->validate()) {
         return false;
     }
     $this->_user->status = Users::ACTIVE;
     if ($this->_user->save()) {
         return $this->_meta->delete();
     }
     return false;
 }
Пример #2
0
 /**
  * Resets the user's password
  * @return boolean
  */
 public function save()
 {
     if (!$this->validate()) {
         return false;
     }
     // Update the user's password
     $this->_user->password = $this->password;
     if ($this->_user->save()) {
         // Delete the hash and expires to prevent reuse attemps
         $this->_hash->delete();
         $this->_expires->delete();
         return true;
     }
     return false;
 }
Пример #3
0
 /**
  * Updates the user's email address and rehashes their password since the password is bound to the email
  * @return boolean
  */
 public function save()
 {
     if (!$this->validate()) {
         return false;
     }
     // This is super buggy for some reason
     $this->_user->email = $this->_newEmailAddress->value;
     // Save the model
     if ($this->_user->save()) {
         // Delete the metadata
         $this->_newEmailAddressChangeKey->delete();
         $this->_newEmailAddress->delete();
         return true;
     }
     return false;
 }