import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -9,20 +9,20 @@
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class Users_LoginController extends Monkeys_Controller_Action
|
||||
/**
|
||||
* We don't use the session with the login form to simplify the dynamic appearance of the captcha
|
||||
*/
|
||||
class Users_LoginController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$settings = new Settings();
|
||||
$settings = new Model_Settings();
|
||||
$this->view->maintenanceEnabled = $settings->isMaintenanceMode();
|
||||
|
||||
$appSession = Zend_Registry::get('appSession');
|
||||
if (isset($appSession->loginForm)) {
|
||||
$this->view->loginForm = $appSession->loginForm;
|
||||
unset($appSession->loginForm);
|
||||
} else {
|
||||
$this->view->loginForm = new LoginForm();
|
||||
}
|
||||
$authAttempts = new Users_Model_AuthAttempts();
|
||||
$attempt = $authAttempts->get();
|
||||
$this->view->useCaptcha = $attempt && $attempt->surpassedMaxAllowed();
|
||||
$this->view->loginForm = new Users_Form_Login(null, $this->view->base, $this->view->useCaptcha);
|
||||
|
||||
if ($this->_config->SSL->enable_mixed_mode) {
|
||||
$this->view->loginTargetBase = 'https://' . $_SERVER['HTTP_HOST'] . $this->view->base;
|
||||
@ -35,46 +35,43 @@ class Users_LoginController extends Monkeys_Controller_Action
|
||||
|
||||
public function authenticateAction()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$authAttempts = new Users_Model_AuthAttempts();
|
||||
$attempt = $authAttempts->get();
|
||||
|
||||
$form = new LoginForm();
|
||||
$form = new Users_Form_Login(null, $this->view->base, $attempt && $attempt->surpassedMaxAllowed());
|
||||
$formData = $this->_request->getPost();
|
||||
$form->populate($formData);
|
||||
$appSession = Zend_Registry::get('appSession');
|
||||
|
||||
if (!$form->isValid($formData)) {
|
||||
$appSession->loginForm = $form;
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Invalid credentials'));
|
||||
$this->_redirectToNormalConnection('');
|
||||
}
|
||||
|
||||
$db = Zend_Db::factory($this->_config->database);
|
||||
$authAdapter = new Zend_Auth_Adapter_DbTable($db, 'users', 'username', 'password', 'MD5(CONCAT(openid, ?))');
|
||||
$authAdapter->setIdentity($this->_request->getPost('username'));
|
||||
$authAdapter->setCredential($this->_request->getPost('password'));
|
||||
$users = new Users_Model_Users();
|
||||
$result = $users->authenticate($this->_request->getPost('username'),
|
||||
$this->_request->getPost('password'));
|
||||
|
||||
$result = $auth->authenticate($authAdapter);
|
||||
if ($result) {
|
||||
$user = $users->getUser();
|
||||
|
||||
if ($result->isValid()) {
|
||||
$users = new Users();
|
||||
$user = $users->getUser($result->getIdentity());
|
||||
|
||||
// $user might not exist when the openid validation passed, but there's no
|
||||
// user in the system with that openid identity
|
||||
if (!$user) {
|
||||
if ($attempt) {
|
||||
$attempt = $authAttempts->delete();
|
||||
}
|
||||
|
||||
if ($user->role != Users_Model_User::ROLE_ADMIN && $this->underMaintenance) {
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
$this->_helper->FlashMessenger->addMessage('Invalid credentials');
|
||||
} else {
|
||||
$auth->getStorage()->write($user);
|
||||
|
||||
if ($user->role != User::ROLE_ADMIN && $this->underMaintenance) {
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
|
||||
return $this->_redirectForMaintenance(true);
|
||||
}
|
||||
return $this->_redirectForMaintenance(true);
|
||||
}
|
||||
} else {
|
||||
$this->_helper->FlashMessenger->addMessage('Invalid credentials');
|
||||
$appSession->loginForm = $form;
|
||||
if (!$attempt) {
|
||||
$authAttempts->create();
|
||||
} else {
|
||||
$attempt->addFailure();
|
||||
$attempt->save();
|
||||
}
|
||||
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Invalid credentials'));
|
||||
}
|
||||
|
||||
$this->_redirectToNormalConnection('');
|
||||
|
@ -9,7 +9,7 @@
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class Users_ManageusersController extends Monkeys_Controller_Action
|
||||
class Users_ManageusersController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
@ -27,7 +27,76 @@ class Users_ManageusersController extends Monkeys_Controller_Action
|
||||
|
||||
public function deleteunconfirmedAction()
|
||||
{
|
||||
$users = new Users();
|
||||
$users->deleteUnconfirmed();
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
|
||||
$users = new Users_Model_Users();
|
||||
$users->deleteUnconfirmed($this->_getParam('olderthan'));
|
||||
}
|
||||
|
||||
public function sendreminderAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
|
||||
$users = new Users_Model_Users();
|
||||
foreach ($users->getUnconfirmedUsers($this->_getParam('olderthan')) as $user) {
|
||||
$mail = self::getMail($user, $this->view->translate('Community-ID registration reminder'));
|
||||
try {
|
||||
$mail->send();
|
||||
} catch (Zend_Mail_Protocol_Exception $e) {
|
||||
Zend_Registry::get('logger')->log($e->getMessage(), Zend_Log::ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Mail
|
||||
* @throws Zend_Mail_Protocol_Exception
|
||||
*/
|
||||
public static function getMail(User $user, $subject)
|
||||
{
|
||||
$locale = Zend_Registry::get('Zend_Locale');
|
||||
$localeElements = explode('_', $locale);
|
||||
if (file_exists(APP_DIR . "/resources/$locale/reminder_mail.txt")) {
|
||||
$file = APP_DIR . "/resources/$locale/reminder_mail.txt";
|
||||
} else if (count($localeElements == 2)
|
||||
&& file_exists(APP_DIR . "/resources/".$localeElements[0]."/reminder_mail.txt")) {
|
||||
$file = APP_DIR . "/resources/".$localeElements[0]."/reminder_mail.txt";
|
||||
} else {
|
||||
$file = APP_DIR . "/resources/en/reminder_mail.txt";
|
||||
}
|
||||
|
||||
$emailTemplate = file_get_contents($file);
|
||||
$emailTemplate = str_replace('{userName}', $user->getFullName(), $emailTemplate);
|
||||
|
||||
$currentUrl = Zend_OpenId::selfURL();
|
||||
preg_match('#(.*)/manageusers/sendreminder#', $currentUrl, $matches);
|
||||
$emailTemplate = str_replace('{registrationURL}', $matches[1] . '/register/eula?token=' . $user->token, $emailTemplate);
|
||||
|
||||
// can't use $this-_config 'cause it's a static function
|
||||
$configEmail = Zend_Registry::get('config')->email;
|
||||
|
||||
switch (strtolower($configEmail->transport)) {
|
||||
case 'smtp':
|
||||
Zend_Mail::setDefaultTransport(
|
||||
new Zend_Mail_Transport_Smtp(
|
||||
$configEmail->host,
|
||||
$configEmail->toArray()
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'mock':
|
||||
Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Mock());
|
||||
break;
|
||||
default:
|
||||
Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Sendmail());
|
||||
}
|
||||
|
||||
$mail = new Zend_Mail('UTF-8');
|
||||
$mail->setBodyText($emailTemplate);
|
||||
$mail->setFrom($configEmail->supportemail);
|
||||
$mail->addTo($user->email);
|
||||
$mail->setSubject($subject);
|
||||
|
||||
return $mail;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class Users_PersonalinfoController extends Monkeys_Controller_Action
|
||||
class Users_PersonalinfoController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
@ -18,7 +18,7 @@ class Users_PersonalinfoController extends Monkeys_Controller_Action
|
||||
|
||||
public function showAction()
|
||||
{
|
||||
$fields = new Fields();
|
||||
$fields = new Model_Fields();
|
||||
$this->view->fields = $fields->getValues($this->user);
|
||||
}
|
||||
|
||||
@ -29,14 +29,14 @@ class Users_PersonalinfoController extends Monkeys_Controller_Action
|
||||
$this->view->fields = $appSession->personalInfoForm->getElements();
|
||||
unset($appSession->personalInfoForm);
|
||||
} else {
|
||||
$personalInfoForm = new PersonalInfoForm(null, $this->user);
|
||||
$personalInfoForm = new Users_Form_PersonalInfo(null, $this->user);
|
||||
$this->view->fields = $personalInfoForm->getElements();
|
||||
}
|
||||
}
|
||||
|
||||
public function saveAction()
|
||||
{
|
||||
$form = new PersonalInfoForm(null, $this->user);
|
||||
$form = new Users_Form_PersonalInfo(null, $this->user);
|
||||
$formData = $this->_request->getPost();
|
||||
|
||||
$form->populate($formData);
|
||||
@ -47,7 +47,7 @@ class Users_PersonalinfoController extends Monkeys_Controller_Action
|
||||
return;
|
||||
}
|
||||
|
||||
$fieldsValues = new FieldsValues();
|
||||
$fieldsValues = new Model_FieldsValues();
|
||||
$fieldsValues->deleteForUser($this->user);
|
||||
|
||||
foreach ($form->getValues() as $fieldName => $fieldValue) {
|
||||
|
@ -9,11 +9,11 @@
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class Users_ProfileController extends Monkeys_Controller_Action
|
||||
class Users_ProfileController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
if (!$this->targetUser->id && $this->user->role != User::ROLE_ADMIN) {
|
||||
if (!$this->targetUser->id && $this->user->role != Users_Model_User::ROLE_ADMIN) {
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
}
|
||||
|
||||
|
@ -9,13 +9,13 @@
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class Users_ProfilegeneralController extends Monkeys_Controller_Action
|
||||
class Users_ProfilegeneralController extends CommunityID_Controller_Action
|
||||
{
|
||||
private $_users;
|
||||
|
||||
public function preDispatch()
|
||||
{
|
||||
if ($this->user->role != User::ROLE_ADMIN
|
||||
if ($this->user->role != Users_Model_User::ROLE_ADMIN
|
||||
&& $this->targetUser->id != $this->user->id)
|
||||
{
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
@ -30,7 +30,7 @@ class Users_ProfilegeneralController extends Monkeys_Controller_Action
|
||||
{
|
||||
if ($this->targetUser->id != $this->user->id
|
||||
// this condition checks for an non-admin trying to add a new user
|
||||
&& ($this->targetUser->id != 0 || $this->user->role != User::ROLE_ADMIN))
|
||||
&& ($this->targetUser->id != 0 || $this->user->role != Users_Model_User::ROLE_ADMIN))
|
||||
{
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
}
|
||||
@ -40,7 +40,7 @@ class Users_ProfilegeneralController extends Monkeys_Controller_Action
|
||||
$this->view->accountInfoForm = $appSession->accountInfoForm;
|
||||
unset($appSession->accountInfoForm);
|
||||
} else {
|
||||
$this->view->accountInfoForm = new AccountInfoForm(null, $this->targetUser);
|
||||
$this->view->accountInfoForm = new Users_Form_AccountInfo(null, $this->targetUser);
|
||||
$this->view->accountInfoForm->populate(array(
|
||||
'username' => $this->targetUser->username,
|
||||
'firstname' => $this->targetUser->firstname,
|
||||
@ -59,7 +59,7 @@ class Users_ProfilegeneralController extends Monkeys_Controller_Action
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
}
|
||||
|
||||
$form = new AccountInfoForm(null, $this->targetUser);
|
||||
$form = new Users_Form_AccountInfo(null, $this->targetUser);
|
||||
$formData = $this->_request->getPost();
|
||||
|
||||
$form->populate($formData);
|
||||
@ -98,7 +98,7 @@ class Users_ProfilegeneralController extends Monkeys_Controller_Action
|
||||
$this->targetUser->accepted_eula = 1;
|
||||
$this->targetUser->registration_date = date('Y-m-d');
|
||||
$this->targetUser->openid = $this->_generateOpenId($this->targetUser->username);
|
||||
$this->targetUser->role = User::ROLE_REGISTERED;
|
||||
$this->targetUser->role = Users_Model_User::ROLE_REGISTERED;
|
||||
$this->targetUser->setClearPassword($form->getValue('password1'));
|
||||
}
|
||||
$this->targetUser->save();
|
||||
@ -115,7 +115,7 @@ class Users_ProfilegeneralController extends Monkeys_Controller_Action
|
||||
private function _usernameAlreadyExists($username)
|
||||
{
|
||||
$users = $this->_getUsers();
|
||||
return $users->getUser($username);
|
||||
return $users->getUserWithUsername($username);
|
||||
}
|
||||
|
||||
private function _emailAlreadyExists($email)
|
||||
@ -154,7 +154,7 @@ class Users_ProfilegeneralController extends Monkeys_Controller_Action
|
||||
$this->view->changePasswordForm = $appSession->changePasswordForm;
|
||||
unset($appSession->changePasswordForm);
|
||||
} else {
|
||||
$this->view->changePasswordForm = new ChangePasswordForm();
|
||||
$this->view->changePasswordForm = new Users_Form_ChangePassword();
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ class Users_ProfilegeneralController extends Monkeys_Controller_Action
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
}
|
||||
|
||||
$form = new ChangePasswordForm();
|
||||
$form = new Users_Form_ChangePassword();
|
||||
$formData = $this->_request->getPost();
|
||||
$form->populate($formData);
|
||||
if (!$form->isValid($formData)) {
|
||||
@ -252,7 +252,7 @@ EOT;
|
||||
}
|
||||
|
||||
if ($this->_config->subdomain->enabled) {
|
||||
$openid = $this->_getProtocol() . '://' . $username . '.' . $this->_config->subdomain->hostname;
|
||||
$openid = $this->getProtocol() . '://' . $username . '.' . $this->_config->subdomain->hostname;
|
||||
} else {
|
||||
$openid = $matches[1] . "/identity/$username";
|
||||
}
|
||||
@ -299,7 +299,7 @@ EOT;
|
||||
private function _getUsers()
|
||||
{
|
||||
if (!isset($this->_users)) {
|
||||
$this->_users = new Users();
|
||||
$this->_users = new Users_Model_Users();
|
||||
}
|
||||
|
||||
return $this->_users;
|
||||
|
@ -9,13 +9,13 @@
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class Users_RecoverpasswordController extends Monkeys_Controller_Action
|
||||
class Users_RecoverpasswordController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
if ($this->user->role != User::ROLE_ADMIN && $this->underMaintenance) {
|
||||
if ($this->user->role != Users_Model_User::ROLE_ADMIN && $this->underMaintenance) {
|
||||
return $this->_redirectForMaintenance();
|
||||
}
|
||||
}
|
||||
@ -27,7 +27,7 @@ class Users_RecoverpasswordController extends Monkeys_Controller_Action
|
||||
$this->view->form = $appSession->recoverPasswordForm;
|
||||
unset($appSession->recoverPasswordForm);
|
||||
} else {
|
||||
$this->view->form = new RecoverPasswordForm();
|
||||
$this->view->form = new Users_Form_RecoverPassword();
|
||||
}
|
||||
|
||||
$this->_helper->actionStack('index', 'login', 'users');
|
||||
@ -35,7 +35,7 @@ class Users_RecoverpasswordController extends Monkeys_Controller_Action
|
||||
|
||||
public function sendAction()
|
||||
{
|
||||
$form = new RecoverPasswordForm();
|
||||
$form = new Users_Form_RecoverPassword();
|
||||
$formData = $this->_request->getPost();
|
||||
|
||||
$form->populate($formData);
|
||||
@ -45,7 +45,7 @@ class Users_RecoverpasswordController extends Monkeys_Controller_Action
|
||||
return $this->_forward('index');
|
||||
}
|
||||
|
||||
$users = new Users();
|
||||
$users = new Users_Model_Users();
|
||||
$user = $users->getUserWithEmail($form->getValue('email'));
|
||||
if (!$user) {
|
||||
$form->email->addError($this->view->translate('This E-mail is not registered in the system'));
|
||||
@ -54,7 +54,7 @@ class Users_RecoverpasswordController extends Monkeys_Controller_Action
|
||||
return $this->_forward('index');
|
||||
}
|
||||
|
||||
$user->token = User::generateToken();
|
||||
$user->token = Users_Model_User::generateToken();
|
||||
$user->save();
|
||||
|
||||
$locale = Zend_Registry::get('Zend_Locale');
|
||||
@ -87,7 +87,7 @@ class Users_RecoverpasswordController extends Monkeys_Controller_Action
|
||||
|
||||
public function resetAction()
|
||||
{
|
||||
$users = new Users();
|
||||
$users = new Users_Model_Users();
|
||||
$user = $users->getUserWithToken($this->_getParam('token'));
|
||||
if (!$user) {
|
||||
$this->_helper->FlashMessenger->addMessage('Wrong Token');
|
||||
@ -99,7 +99,7 @@ class Users_RecoverpasswordController extends Monkeys_Controller_Action
|
||||
$user->setClearPassword($newPassword);
|
||||
|
||||
// reset token
|
||||
$user->token = User::generateToken();
|
||||
$user->token = Users_Model_User::generateToken();
|
||||
|
||||
$user->save();
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class Users_RegisterController extends Monkeys_Controller_Action
|
||||
class Users_RegisterController extends CommunityID_Controller_Action
|
||||
{
|
||||
protected $_numCols = 1;
|
||||
|
||||
@ -17,7 +17,7 @@ class Users_RegisterController extends Monkeys_Controller_Action
|
||||
{
|
||||
parent::init();
|
||||
|
||||
if ($this->user->role != User::ROLE_ADMIN && $this->underMaintenance) {
|
||||
if ($this->user->role != Users_Model_User::ROLE_ADMIN && $this->underMaintenance) {
|
||||
return $this->_redirectForMaintenance();
|
||||
}
|
||||
|
||||
@ -36,14 +36,14 @@ class Users_RegisterController extends Monkeys_Controller_Action
|
||||
$form = $appSession->registerForm;
|
||||
unset($appSession->registerForm);
|
||||
} else {
|
||||
$form = new RegisterForm(null, $this->view->base);
|
||||
$form = new Users_Form_Register(null, $this->view->base);
|
||||
}
|
||||
$this->view->form = $form;
|
||||
}
|
||||
|
||||
public function saveAction()
|
||||
{
|
||||
$form = new RegisterForm(null, $this->view->base);
|
||||
$form = new Users_Form_Register(null, $this->view->base);
|
||||
$formData = $this->_request->getPost();
|
||||
$form->populate($formData);
|
||||
|
||||
@ -53,9 +53,9 @@ class Users_RegisterController extends Monkeys_Controller_Action
|
||||
return $this->_forward('index', null, null);
|
||||
}
|
||||
|
||||
$users = new Users();
|
||||
$users = new Users_Model_Users();
|
||||
|
||||
if ($users->getUser($form->getValue('username'))) {
|
||||
if ($users->getUserWithUsername($form->getValue('username'))) {
|
||||
$form->username->addError($this->view->translate('This username is already in use'));
|
||||
$appSession = Zend_Registry::get('appSession');
|
||||
$appSession->registerForm = $form;
|
||||
@ -79,7 +79,7 @@ class Users_RegisterController extends Monkeys_Controller_Action
|
||||
$currentUrl = Zend_OpenId::selfURL();
|
||||
preg_match('#(.*)/users/register/save#', $currentUrl, $matches);
|
||||
if ($this->_config->subdomain->enabled) {
|
||||
$openid = $this->_getProtocol() . '://' . $user->username . '.' . $this->_config->subdomain->hostname;
|
||||
$openid = $this->getProtocol() . '://' . $user->username . '.' . $this->_config->subdomain->hostname;
|
||||
} else {
|
||||
$openid = $matches[1] . '/identity/' . $user->username;
|
||||
}
|
||||
@ -91,14 +91,14 @@ class Users_RegisterController extends Monkeys_Controller_Action
|
||||
$user->openid = $openid;
|
||||
|
||||
$user->setClearPassword($form->getValue('password1'));
|
||||
$user->role = User::ROLE_GUEST;
|
||||
$registrationToken = User::generateToken();
|
||||
$user->role = Users_Model_User::ROLE_GUEST;
|
||||
$registrationToken = Users_Model_User::generateToken();
|
||||
$user->token = $registrationToken;
|
||||
$user->accepted_eula = 0;
|
||||
$user->registration_date = date('Y-m-d');
|
||||
$user->save();
|
||||
|
||||
$mail = $this->getMail($user);
|
||||
$mail = self::getMail($user, $this->view->translate('Community-ID registration confirmation'));
|
||||
try {
|
||||
$mail->send();
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Thank you.'));
|
||||
@ -115,7 +115,7 @@ class Users_RegisterController extends Monkeys_Controller_Action
|
||||
|
||||
public function eulaAction()
|
||||
{
|
||||
$users = new Users();
|
||||
$users = new Users_Model_Users();
|
||||
if ($this->_request->getParam('token') == ''
|
||||
|| !($user = $users->getUserWithToken($this->_request->getParam('token')))) {
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Invalid token'));
|
||||
@ -141,7 +141,7 @@ class Users_RegisterController extends Monkeys_Controller_Action
|
||||
|
||||
public function declineeulaAction()
|
||||
{
|
||||
$users = new Users();
|
||||
$users = new Users_Model_Users();
|
||||
|
||||
if ($this->_request->getParam('token') == ''
|
||||
|| !($user = $users->getUserWithToken($this->_request->getParam('token')))) {
|
||||
@ -157,14 +157,14 @@ class Users_RegisterController extends Monkeys_Controller_Action
|
||||
|
||||
public function accepteulaAction()
|
||||
{
|
||||
$users = new Users();
|
||||
$users = new Users_Model_Users();
|
||||
if ($this->_request->getParam('token') == ''
|
||||
|| !($user = $users->getUserWithToken($this->_request->getParam('token')))) {
|
||||
$this->_helper->FlashMessenger->addMessage($this->view->translate('Invalid token'));
|
||||
$this->_redirect('');
|
||||
}
|
||||
|
||||
$user->role = User::ROLE_REGISTERED;
|
||||
$user->role = Users_Model_User::ROLE_REGISTERED;
|
||||
$user->accepted_eula = 1;
|
||||
$user->registration_date = date('Y-m-d');
|
||||
$user->token = '';
|
||||
@ -180,7 +180,7 @@ class Users_RegisterController extends Monkeys_Controller_Action
|
||||
* @return Zend_Mail
|
||||
* @throws Zend_Mail_Protocol_Exception
|
||||
*/
|
||||
public function getMail(User $user)
|
||||
public static function getMail(Users_Model_User $user, $subject)
|
||||
{
|
||||
$locale = Zend_Registry::get('Zend_Locale');
|
||||
$localeElements = explode('_', $locale);
|
||||
@ -221,9 +221,9 @@ class Users_RegisterController extends Monkeys_Controller_Action
|
||||
|
||||
$mail = new Zend_Mail('UTF-8');
|
||||
$mail->setBodyText($emailTemplate);
|
||||
$mail->setFrom($this->_config->email->supportemail);
|
||||
$mail->setFrom($configEmail->supportemail);
|
||||
$mail->addTo($user->email);
|
||||
$mail->setSubject($this->view->translate('Community-ID registration confirmation'));
|
||||
$mail->setSubject($subject);
|
||||
|
||||
return $mail;
|
||||
}
|
||||
|
@ -9,20 +9,20 @@
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class Users_UserslistController extends Monkeys_Controller_Action
|
||||
class Users_UserslistController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
|
||||
$users = new Users();
|
||||
$users = new Users_Model_Users();
|
||||
|
||||
switch($this->_getParam('filter')) {
|
||||
case 'confirmed':
|
||||
$where = "accepted_eula=1 AND role != '".User::ROLE_ADMIN."'";
|
||||
$where = "accepted_eula=1 AND role != '".Users_Model_User::ROLE_ADMIN."'";
|
||||
break;
|
||||
case 'unconfirmed':
|
||||
$where = "accepted_eula=0 AND role != '".User::ROLE_ADMIN."'";
|
||||
$where = "accepted_eula=0 AND role != '".Users_Model_User::ROLE_ADMIN."'";
|
||||
break;
|
||||
default:
|
||||
$where = false;
|
||||
@ -33,20 +33,22 @@ class Users_UserslistController extends Monkeys_Controller_Action
|
||||
$this->_getParam('startIndex'),
|
||||
$this->_getParam('results'),
|
||||
$this->_getParam('sort', 'registration'),
|
||||
$this->_getParam('dir', Users::DIR_DESC),
|
||||
$where);
|
||||
$this->_getParam('dir', Users_Model_Users::DIR_DESC),
|
||||
$where,
|
||||
trim($this->_getParam('search')));
|
||||
|
||||
$jsonObj = new StdClass();
|
||||
$jsonObj->recordsReturned = count($usersRows);
|
||||
$jsonObj->totalRecords = $users->getNumUsers();
|
||||
$jsonObj->totalRecords = $users->getNumUsers($where, trim($this->_getParam('search')));
|
||||
$jsonObj->totalUsers = $users->getNumUsers();
|
||||
$jsonObj->totalUnconfirmedUsers = $users->getNumUnconfirmedUsers();
|
||||
$jsonObj->startIndex = $_GET['startIndex'];
|
||||
$jsonObj->startIndex = $this->_getParam('startIndex');
|
||||
$jsonObj->sort = $this->_getParam('sort');
|
||||
$jsonObj->dir = $this->_getParam('dir');
|
||||
$jsonObj->records = array();
|
||||
|
||||
foreach ($usersRows as $user) {
|
||||
if ($user->role == User::ROLE_ADMIN) {
|
||||
if ($user->role == Users_Model_User::ROLE_ADMIN) {
|
||||
$status = $this->view->translate('admin');
|
||||
} else if ($user->accepted_eula) {
|
||||
$status = $this->view->translate('confirmed');
|
||||
|
Reference in New Issue
Block a user