本文整理汇总了PHP中UserAccount::getActivationKey方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAccount::getActivationKey方法的具体用法?PHP UserAccount::getActivationKey怎么用?PHP UserAccount::getActivationKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAccount
的用法示例。
在下文中一共展示了UserAccount::getActivationKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: changeemailAction
function changeemailAction()
{
$session = SessionWrapper::getInstance();
$formvalues = $this->_getAllParams();
if (!isArrayKeyAnEmptyString('actkey', $formvalues) && !isArrayKeyAnEmptyString('ref', $formvalues)) {
$newemail = decode($formvalues['ref']);
$user = new UserAccount();
$user->populate(decode($formvalues['id']));
$oldemail = $user->getEmail();
# validate the activation code
if ($formvalues['actkey'] != $user->getActivationKey()) {
$session->setVar(ERROR_MESSAGE, "Invalid activation code specified for email activation");
$failureurl = $this->view->baseUrl('profile/view/id/' . encode($user->getID()));
$this->_helper->redirector->gotoUrl($failureurl);
}
$user->setActivationKey('');
$user->setEmail($newemail);
$user->setEmail2('');
$user->save();
$view = new Zend_View();
$url = $this->view->serverUrl($this->view->baseUrl('profile/view/id/' . encode($user->getID())));
$usecase = '1.12';
$module = '1';
$type = USER_CHANGE_EMAIL_CONFIRM;
$details = "New Email (" . $user->getEmail() . ") activated for <a href='" . $url . "' class='blockanchor'>" . $user->getName() . "</a>";
$browser = new Browser();
$audit_values = $session->getVar('browseraudit');
$audit_values['module'] = $module;
$audit_values['usecase'] = $usecase;
$audit_values['transactiontype'] = $type;
$audit_values['userid'] = $session->getVar('userid');
$audit_values['url'] = $url;
$audit_values['transactiondetails'] = $details;
$audit_values['status'] = "Y";
// debugMessage($audit_values);
$this->notify(new sfEvent($this, $type, $audit_values));
$successmessage = "Successfully updated. Please note that you can no longer login using your previous Email Address";
$session->setVar(SUCCESS_MESSAGE, $successmessage);
$this->_helper->redirector->gotoUrl($this->view->baseUrl('profile/view/id/' . encode($user->getID())));
}
}
示例2: resetpasswordAction
public function resetpasswordAction()
{
$session = SessionWrapper::getInstance();
$user = new UserAccount();
$user->populate(decode($this->_getParam('id')));
// verify that the activation key in the url matches the one in the database
if ($user->getActivationKey() != $this->_getParam('actkey')) {
// send a link to enable the user to recover their password
$error = "Invalid reset link. <br />Please try to recover your password again";
$session->setVar(ERROR_MESSAGE, $error);
$this->_helper->redirector->gotoUrl($this->view->baseUrl("user/login"));
}
}
示例3: activateAction
function activateAction()
{
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$session = SessionWrapper::getInstance();
$formvalues = $this->_getAllParams();
if (!isArrayKeyAnEmptyString('id', $formvalues)) {
// debugMessage($formvalues);
$user = new UserAccount();
$user->populate(decode($formvalues['id']));
// debugMessage($user->toArray()); // exit;
if ($user->isUserActive() && isEmptyString($user->getActivationKey())) {
// account already activated
$session->setVar(ERROR_MESSAGE, 'Account is already activated. Please login.');
$this->_helper->redirector->gotoUrl($this->view->baseUrl("user/login"));
}
$this->_setParam(URL_FAILURE, encode($this->view->baseUrl("signup/confirm/id/" . encode($user->getID()))));
$key = $this->_getParam('actkey');
$this->view->result = $user->activateAccount($key);
// exit();
if (!$this->view->result) {
// activation failed
$this->view->message = $user->getErrorStackAsString();
$session->setVar(FORM_VALUES, $this->_getAllParams());
$session->setVar(ERROR_MESSAGE, $user->getErrorStackAsString());
// debugMessage('error '.$user->getErrorStackAsString());
} else {
# send activation confirmation
$user->sendActivationConfirmationNotification();
$session->setVar(SUCCESS_MESSAGE, "Account activated successfully. Please login to start.");
}
}
$this->_helper->redirector->gotoUrl($this->view->baseUrl("user/login"));
// exit;
}