Exemple #1
0
 /**
  * Changes account password
  * @param array $post
  * @return boolean
  */
 public function changePassword($post)
 {
     // Validate create before continue
     $result = $this->validatePassword($post);
     if (!$result) {
         return false;
     }
     // Load account
     $username = BootWiki::getLoggedAccount()->username;
     $account = R::findOne('account', 'username = ?', array($username));
     $account->password = $post['password'];
     R::store($account);
     $this->importBean($account);
     // Encrypt password
     $passwd = BootWiki::encrypt($post['password']);
     $account->password = $passwd;
     R::store($account);
     // Send email to user
     $this->template_path = BootWiki::template('register_mail');
     $message = (string) $this;
     BootWiki::sendMail($username, 'BootWiki - New password', $message);
     // Return success
     BootWiki::setMessage('Password has changed!');
     return true;
 }
Exemple #2
0
 /**
  * Creates a new Block
  * @param string $template_name
  * @param string $html It may hold a sub-content
  */
 public function __construct($template_name, $html = '')
 {
     $this->template_path = BootWiki::template($template_name);
     $this->html = $html;
 }