public function actionForm() { $publicSession = XenForo_Session::getPublicSession($this->_request); if ($publicSession->get('user_id')) { $publicVisitor = $this->getModelFromCache('XenForo_Model_User')->getUserById($publicSession->get('user_id')); if ($publicVisitor) { XenForo_Visitor::getInstance()->setVisitorLanguage($publicVisitor['language_id']); } } else { $publicVisitor = false; } if ($this->_request->isPost()) { $repost = true; $postVars = $_POST; if (!isset($postVars['redirect'])) { $postVars['redirect'] = $this->getDynamicRedirect(); } } else { $repost = false; $postVars = false; } $viewParams = array('publicVisitor' => $publicVisitor, 'repost' => $repost, 'postVars' => $postVars); $containerParams = array('containerTemplate' => 'LOGIN_PAGE'); return $this->responseView('XenForo_ViewAdmin_Login_Form', 'login_form', $viewParams, $containerParams); }
/** * Confirms a lost password reset request and resets the password. * * @return XenForo_ControllerResponse_Abstract */ public function actionParentalControlLostPasswordConfirm() { $confirmationModel = $this->_getUserConfirmationModel(); $visitor = XenForo_Visitor::getInstance(); $sessionId = XenForo_Session::getPublicSession(new Zend_Controller_Request_Http())->getSessionId(); if (isset($visitor['parent_session']) && $visitor['parent_session'] && $visitor['parent_session'] == $sessionId) { return $this->responseRedirect(XenForo_ControllerResponse_Redirect::RESOURCE_CANONICAL, XenForo_Link::buildPublicLink('account/parental-control')); } $userId = XenForo_Visitor::getUserId(); $confirmation = $confirmationModel->getUserConfirmationRecord($userId, 'parent_password'); if (!$confirmation) { if (XenForo_Visitor::getUserId()) { return $this->responseError(new XenForo_Phrase('your_password_could_not_be_reset')); } } $confirmationKey = $this->_input->filterSingle('c', XenForo_Input::STRING); if ($confirmationKey) { $accountConfirmed = $confirmationModel->validateUserConfirmationRecord($confirmationKey, $confirmation); } else { $accountConfirmed = false; } if ($accountConfirmed) { $confirmationModel->resetParentPassword($userId); $confirmationModel->deleteUserConfirmationRecord($userId, 'password'); return $this->responseMessage(new XenForo_Phrase('your_password_has_been_reset')); } else { return $this->responseError(new XenForo_Phrase('your_password_could_not_be_reset')); } }
public function isParentLoggedIn($viewingUser = null) { $this->standardizeViewingUserReference($viewingUser); $sessionId = XenForo_Session::getPublicSession(new Zend_Controller_Request_Http())->getSessionId(); if (!isset($viewingUser['parent_session']) || !$viewingUser['parent_session'] || $viewingUser['parent_session'] != $sessionId) { return false; } return true; }