Exemplo n.º 1
0
 /**
  * Inidicates that an activation link has been clicked and any forms displayed
  * there have been successfully filled out.
  * @author dekarma
  */
 function activate($key)
 {
     // get activate info
     $info = MEMBER::getActivationInfo($key);
     // no active key
     if (!$info) {
         return false;
     }
     switch ($info->vtype) {
         case 'forgot':
             // nothing to do
             break;
         case 'register':
             // set canlogin value
             global $CONF;
             sql_query('UPDATE ' . sql_table('member') . ' SET mcanlogin='******'NewMemberCanLogon']) . ' WHERE mnumber=' . intval($info->vmember));
             break;
         case 'addresschange':
             // reset old 'canlogin' value
             list($oldEmail, $oldCanLogin) = explode('/', $info->vextra);
             sql_query('UPDATE ' . sql_table('member') . ' SET mcanlogin='******' WHERE mnumber=' . intval($info->vmember));
             break;
     }
     // delete from activation table
     sql_query('DELETE FROM ' . sql_table('activation') . ' WHERE vkey=\'' . sql_real_escape_string($key) . '\'');
     // success!
     return true;
 }
Exemplo n.º 2
0
 /**
  * Account activation - set password part
  *
  * @author dekarma
  */
 function action_activatesetpwd()
 {
     $key = postVar('key');
     // clean up old activation keys
     MEMBER::cleanupActivationTable();
     // get activation info
     $info = MEMBER::getActivationInfo($key);
     if (!$info || $info->type == 'addresschange') {
         return $this->_showActivationPage($key, _ERROR_ACTIVATE);
     }
     $mem = MEMBER::createFromId($info->vmember);
     if (!$mem) {
         return $this->_showActivationPage($key, _ERROR_ACTIVATE);
     }
     $password = postVar('password');
     $repeatpassword = postVar('repeatpassword');
     if (!$password) {
         return $this->_showActivationPage($key, _ERROR_PASSWORDMISSING);
     }
     if ($password != $repeatpassword) {
         return $this->_showActivationPage($key, _ERROR_PASSWORDMISMATCH);
     }
     if (strlen($password) < 6) {
         return $this->_showActivationPage($key, _ERROR_PASSWORDTOOSHORT);
     }
     $pwdvalid = true;
     $pwderror = '';
     global $manager;
     $manager->notify('PrePasswordSet', array('password' => $password, 'errormessage' => &$pwderror, 'valid' => &$pwdvalid));
     if (!$pwdvalid) {
         return $this->_showActivationPage($key, $pwderror);
     }
     $error = '';
     $manager->notify('ValidateForm', array('type' => 'activation', 'member' => $mem, 'error' => &$error));
     if ($error != '') {
         return $this->_showActivationPage($key, $error);
     }
     // set password
     $mem->setPassword($password);
     $mem->write();
     // do the activation
     MEMBER::activate($key);
     $this->pagehead();
     echo '<h2>', _ACTIVATE_SUCCESS_TITLE, '</h2>';
     echo '<p>', _ACTIVATE_SUCCESS_TEXT, '</p>';
     $this->pagefoot();
 }