Example #1
0
 public static function changePassword($id_or_username, $new_password)
 {
     if (ctype_digit($id_or_username)) {
         $u = new User($id_or_username);
     } else {
         $u = new User();
         $u->select($id_or_username, 'username');
     }
     if ($u->ok()) {
         $u->nid = Auth::newNid();
         $u->password = Auth::hashedPassword($new_password);
         $u->update();
         Auth::clearCookies();
     }
 }
Example #2
0
 public function changeCurrentUsername($new_username)
 {
     $db = Database::getDatabase();
     srand(time());
     $this->user->nid = Auth::newNid();
     $this->nid = $this->user->nid;
     $this->user->username = $new_username;
     $this->username = $this->user->username;
     $this->user->update();
     $this->generateBCCookies();
 }