Example #1
0
 public function execute()
 {
     # Check token
     if (false === ($token = Common::getGet('token'))) {
         return $this->module->error('err_no_token');
     }
     if (false === ($userid = Common::getGet('userid'))) {
         return $this->module->error('err_no_token');
     }
     require_once GWF_CORE_PATH . 'module/Account/GWF_AccountChange.php';
     if (false === ($ac = GWF_AccountChange::checkToken($userid, $token, 'pass'))) {
         return $this->module->error('err_no_token');
     }
     # Do stuff
     if (false !== Common::getPost('change')) {
         return $this->onChangePass($ac);
     }
     return $this->templateChange($ac);
 }
Example #2
0
 private function onChange($token)
 {
     $userid = (int) Common::getGet('userid');
     if (false === ($ac = GWF_AccountChange::checkToken($userid, $token, 'demo'))) {
         return $this->module->error('err_token');
     }
     if (false === ($user = GWF_User::getByID($userid))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if (false === ($data = @unserialize($ac->getVar('data')))) {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     if (false === $user->saveVars($data)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $ac->delete()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     GWF_AccountChange::createToken($userid, 'demo_lock');
     return $this->module->message('msg_demo_changed');
 }
Example #3
0
 private function onChangeB($token)
 {
     $userid = (int) Common::getGet('userid');
     if (false === ($ac = GWF_AccountChange::checkToken($userid, $token, 'email2'))) {
         return $this->module->error('err_token');
     }
     if (false === ($user = $ac->getUser())) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     if (false === $ac->delete()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $oldmail = $user->getValidMail();
     $newmail = $ac->getVar('data');
     if (false === GWF_Hook::call(GWF_Hook::CHANGE_MAIL, $user, array($oldmail, $newmail))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $user->saveVar('user_email', $newmail)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $user->saveOption(GWF_User::MAIL_APPROVED, true)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_mail_changed', array(htmlspecialchars($newmail)));
 }