|
From: <gem...@li...> - 2012-04-02 17:52:42
|
Revision: 591
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=591&view=rev
Author: matijsdejong
Date: 2012-04-02 17:52:30 +0000 (Mon, 02 Apr 2012)
Log Message:
-----------
Created a separate Password Reset form that can be overruled on the project level
New structure of indexAction allows for easy overruling of password display.
TODO: validation / follow up actions should be organized better.
Modified Paths:
--------------
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/User/Form/LoginForm.php
trunk/library/classes/Gems/User/UserLoader.php
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
Added Paths:
-----------
trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php
trunk/library/classes/Gems/User/Form/ResetForm.php
trunk/library/classes/Gems/User/Validate/ResetKeyValidator.php
Modified: trunk/library/classes/Gems/Default/IndexAction.php
===================================================================
--- trunk/library/classes/Gems/Default/IndexAction.php 2012-04-01 23:54:09 UTC (rev 590)
+++ trunk/library/classes/Gems/Default/IndexAction.php 2012-04-02 17:52:30 UTC (rev 591)
@@ -55,21 +55,6 @@
protected $labelWidthFactor = null;
/**
- * @var GemsEscort
- */
- public $escort;
-
- /**
- * @var Gems_Menu
- */
- public $menu;
-
- /**
- * @var Gems_Project_ProjectSettings
- */
- public $project;
-
- /**
* For small numbers of organizations a multiline selectbox will be nice. This
* setting handles how many lines will display at once. Use 1 for the normal
* dropdown selectbox
@@ -93,53 +78,22 @@
protected $showTokenButton = true;
/**
- * Returns a basic form for this action.
- *
- * @param $description Optional description, %s is filled with project name.
- * @return Gems_Form
- */
- protected function _getBasicForm($description = null)
- {
- Gems_Html::init();
-
- $form = new Gems_Form(array('labelWidthFactor' => $this->labelWidthFactor));
- $form->setMethod('post');
- if ($description) {
- $form->setDescription(sprintf($description, $this->project->getName()));
- }
-
- return $form;
- }
-
- /**
- * Returns an element for keeping a reset key.
- *
- * @return Zend_Form_Element_Hidden
- */
- protected function _getKeyElement()
- {
- return new Zend_Form_Element_Hidden('key');
- }
-
- /**
* Returns a login form
*
* @param boolean $showToken Optional, show 'Ask token' button, $this->showTokenButton is used when not specified
* @param boolean $showPasswordLost Optional, show 'Lost password' button, $this->showPasswordLostButton is used when not specified
* @return Gems_User_Form_LoginForm
*/
- protected function _getLoginForm($showToken = null, $showPasswordLost = null)
+ protected function createLoginForm($showToken = null, $showPasswordLost = null)
{
$args = MUtil_Ra::args(func_get_args(),
array(
'showToken' => 'is_boolean',
'showPasswordLost' => 'is_boolean',
- 'description' => 'is_string',
),
array(
'showToken' => $this->showTokenButton,
'showPasswordLost' => $this->showPasswordLostButton,
- 'description' => $this->_('Login to %s application'),
'labelWidthFactor' => $this->labelWidthFactor,
));
@@ -149,121 +103,67 @@
}
/**
- * Returns a link to the login page
+ * Gets a reset password form.
*
- * @return MUtil_Form_Element_Html
+ * @return Gems_User_Form_ResetForm
*/
- protected function _getLoginLinkElement()
+ protected function createResetForm()
{
- // Reset password
- $element = new MUtil_Form_Element_Html('resetPassword');
- $element->br();
- $element->actionLink(array('controller' => 'index', 'action' => 'login'), $this->_('Back to login'));
+ $args = MUtil_Ra::args(func_get_args(),
+ array(),
+ array(
+ 'labelWidthFactor' => $this->labelWidthFactor,
+ ));
- return $element;
- }
+ $this->initHtml();
- /**
- * Returns an element for determining / selecting the organization.
- *
- * @return Zend_Form_Element_Xhtml
- */
- protected function _getOrganizationElement()
- {
- $hidden = $this->escort instanceof Gems_Project_Organization_SingleOrganizationInterface;
- if ($hidden) {
- $org = $this->escort->getRespondentOrganization();
- } else {
- $org = $this->loader->getCurrentUser()->getCurrentOrganizationId();
- $orgs = $this->util->getDbLookup()->getOrganizationsForLogin();
- $hidden = count($orgs) < 2;
- if ($hidden) {
- $org = array_shift(array_keys($orgs));
- }
- }
-
- if ($hidden) {
- $element = new Zend_Form_Element_Hidden('organization');
- $element->setValue($org);
- } else {
- $element = new Zend_Form_Element_Select('organization');
- $element->setLabel($this->_('Organization'));
- $element->setMultiOptions($orgs);
- $element->setRequired(true);
- if ($this->organizationMaxLines > 1) {
- $element->setAttrib('size', max(count($orgs) + 1, $this->organizationMaxLines));
- }
-
- if (! $this->_request->isPost()) {
- $element->setValue($org);
- }
- }
-
- return $element;
+ return $this->loader->getUserLoader()->getResetForm($args);
}
/**
- * Gets a reset password form.
+ * Function for overruling the display of the login form.
*
- * @return Gems_Form
+ * @param Gems_User_Form_LoginForm $form
*/
- protected function _getResetForm()
+ protected function displayLoginForm(Gems_User_Form_LoginForm $form)
{
- $form = $this->_getBasicForm($this->_('Reset password for %s application'));
- $form->addElement($this->_getKeyElement());
- $form->addElement($this->_getOrganizationElement());
- $form->addElement($this->_getUserLoginElement());
- $form->addElement($this->_getSubmitButton($this->_('Reset password')));
- $form->addElement($this->_getLoginLinkElement());
-
- return $form;
+ $this->view->form = $form;
}
/**
- * Returns a link to the reset password page
+ * Function for overruling the display of the reset form.
*
- * @return MUtil_Form_Element_Html
+ * @param Gems_User_Form_ResetForm $form
+ * @param mixed $errors
*/
- protected function _getResetLinkElement()
+ protected function displayResetForm(Gems_User_Form_ResetForm $form, $errors)
{
- // Reset password
- $element = new MUtil_Form_Element_Html('resetPassword');
- $element->br();
- $element->actionLink(array('controller' => 'index', 'action' => 'resetpassword'), $this->_('Lost password'));
+ if ($form->hasResetKey()) {
+ $this->html->h3($this->_('Request password reset'));
+ $p = $this->html->pInfo($this->_('We received your password reset request. '));
- return $element;
- }
+ if ($form->getOrganizationIsVisible()) {
+ $p->append($this->_('Please enter the organization and username/e-mail address belonging to this request.'));
+ } else {
+ $p->append($this->_('Please enter the username or e-mail address belonging to this request.'));
+ }
+ } else {
+ $this->html->h3($this->_('Execute password reset'));
- /**
- * Returns a submit button.
- *
- * @param string $label
- * @return Zend_Form_Element_Submit
- */
- protected function _getSubmitButton($label)
- {
- // Submit knop
- $element = new Zend_Form_Element_Submit('button');
- $element->setLabel($label);
- $element->setAttrib('class', 'button');
+ $p = $this->html->pInfo();
+ if ($form->getOrganizationIsVisible()) {
+ $p->append($this->_('Please enter your organization and your username or e-mail address. '));
+ } else {
+ $p->append($this->_('Please enter your username or e-mail address. '));
+ }
+ $p->append($this->_('We will then send you an e-mail with a link you can use to reset your password.'));
+ }
- return $element;
- }
+ if ($errors) {
+ $this->addMessage($errors);
+ }
- /**
- * Returns a login name element.
- *
- * @return Zend_Form_Element_Text
- */
- protected function _getUserLoginElement()
- {
- // Veld inlognaam
- $element = new Zend_Form_Element_Text('userlogin');
- $element->setLabel($this->_('Username'));
- $element->setAttrib('size', 40);
- $element->setRequired(true);
-
- return $element;
+ $this->html->append($form);
}
/**
@@ -277,7 +177,7 @@
public function loginAction()
{
$request = $this->getRequest();
- $form = $this->_getLoginForm();
+ $form = $this->createLoginForm();
if ($request->isPost()) {
if ($form->isValid($request->getPost(), false)) {
@@ -334,7 +234,8 @@
$log->log('loginFail', $this->getRequest(), $msg, null, true);
} // */
}
- $this->view->form = $form;
+
+ $this->displayLoginForm($form);
}
/**
@@ -358,10 +259,11 @@
$this->view->setScriptPath(GEMS_LIBRARY_DIR . '/views/scripts' );
$request = $this->getRequest();
- $form = $this->_getResetForm();
- if ($request->isPost() && $form->isValid($request->getPost())) {
+ $errors = array();
+ $form = $this->createResetForm();
+ if ($request->isPost() && $form->isValid($request->getParams())) {
- $user = $this->loader->getUser($request->getParam('userlogin'), $request->getParam('organization'));
+ $user = $form->getUser();
If ($user->canResetPassword()) {
if ($key = $request->getParam('key')) {
@@ -373,27 +275,23 @@
$user->gotoStartPage($this->menu, $request);
return;
} else {
- $this->addMessage($this->_('This key timed out or does not belong to this user.'));
+ $errors[] = $this->_('This key timed out or does not belong to this user.');
}
} else {
$subjectTemplate = $this->_('Password reset requested');
$bbBodyTemplate = $this->_("To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n{reset_url}");
- $messages = $user->sendMail($subjectTemplate, $bbBodyTemplate, true);
- if (! $messages) {
+ $errors = $user->sendMail($subjectTemplate, $bbBodyTemplate, true);
+ if (! $errors) {
// Everything went OK!
- $messages = $this->_('We sent you an e-mail with a reset link. Click on the link in the e-mail.');
+ $errors[] = $this->_('We sent you an e-mail with a reset link. Click on the link in the e-mail.');
}
- $this->addMessage($messages);
}
} else {
- $this->addMessage($this->_('No such user found or no e-mail address known or user cannot be reset.'));
+ $errors[] = $this->_('No such user found or no e-mail address known or user cannot be reset.');
}
}
- if ($request->getParam('key')) {
- $this->addMessage($this->_('We received your password reset key.'));
- $this->addMessage($this->_('Please enter the organization and username belonging to this key.'));
- }
- $this->view->form = $form;
+
+ $this->displayResetForm($form, $errors);
}
}
Modified: trunk/library/classes/Gems/User/Form/LoginForm.php
===================================================================
--- trunk/library/classes/Gems/User/Form/LoginForm.php 2012-04-01 23:54:09 UTC (rev 590)
+++ trunk/library/classes/Gems/User/Form/LoginForm.php 2012-04-02 17:52:30 UTC (rev 591)
@@ -44,7 +44,7 @@
* @license New BSD License
* @since Class available since version 1.5
*/
-class Gems_User_Form_LoginForm extends Gems_Form_AutoLoadFormAbstract implements Gems_User_Validate_GetUserInterface
+class Gems_User_Form_LoginForm extends Gems_User_Form_OrganizationFormAbstract
{
/**
* The field name for the lost password element.
@@ -54,20 +54,6 @@
protected $_lostPasswordFieldName = 'lost_password';
/**
- * When true the organization was derived from the the url
- *
- * @var boolean
- */
- protected $_organizationFromUrl = false;
-
- /**
- * The field name for the submit element.
- *
- * @var string
- */
- protected $_submitFieldName = 'button';
-
- /**
* The field name for the token element.
*
* @var string
@@ -75,34 +61,6 @@
protected $_tokenFieldName = 'token_link';
/**
- *
- * @var Gems_User_User
- */
- protected $_user;
-
- /**
- *
- * @var Gems_Loader
- */
- protected $loader;
-
- /**
- * The field name for the organization element.
- *
- * @var string
- */
- public $organizationFieldName = 'organization';
-
- /**
- * For small numbers of organizations a multiline selectbox will be nice. This
- * setting handles how many lines will display at once. Use 1 for the normal
- * dropdown selectbox
- *
- * @var int
- */
- protected $organizationMaxLines = 6;
-
- /**
* The field name for the password element.
*
* @var string
@@ -110,12 +68,6 @@
public $passwordFieldName = 'password';
/**
- *
- * @var Zend_Controller_Request_Abstract
- */
- protected $request;
-
- /**
* The default behaviour for showing a lost password button
*
* @var boolean
@@ -130,59 +82,6 @@
protected $showToken = true;
/**
- *
- * @var Zend_Translate
- */
- protected $translate;
-
- /**
- * The field name for the username element.
- *
- * @var string
- */
- public $usernameFieldName = 'userlogin';
-
- /**
- *
- * @var Zend_Util
- */
- protected $util;
-
- /**
- * Returns the organization id that should currently be used for this form.
- *
- * @return int Returns the current organization id, if any
- */
- public function getCurrentOrganizationId()
- {
- $userLoader = $this->loader->getUserLoader();
-
- // Url determines organization first.
- if ($orgId = $userLoader->getOrganizationIdByUrl()) {
- $this->_organizationFromUrl = true;
- $userLoader->getCurrentUser()->setCurrentOrganization($orgId);
- return $orgId;
- }
-
- $request = $this->getRequest();
- if ($request->isPost() && ($orgId = $request->getParam($this->organizationFieldName))) {
- return $orgId;
- }
-
- return $userLoader->getCurrentUser()->getCurrentOrganizationId();
- }
-
- /**
- * Returns a list with the organizations the user can select for login.
- *
- * @return array orgId => Name
- */
- public function getLoginOrganizations()
- {
- return $this->util->getDbLookup()->getOrganizationsForLogin();
- }
-
- /**
* Returns/sets a link to the reset password page
*
* @return MUtil_Form_Element_Html
@@ -214,47 +113,6 @@
}
/**
- * Returns/sets an element for determining / selecting the organization.
- *
- * @return Zend_Form_Element_Xhtml
- */
- public function getOrganizationElement()
- {
- $element = $this->getElement($this->organizationFieldName);
- $orgId = $this->getCurrentOrganizationId();
- $orgs = $this->getLoginOrganizations();
- $hidden = $this->_organizationFromUrl || (count($orgs) < 2);
-
- if ($hidden) {
- if (! $element instanceof Zend_Form_Element_Hidden) {
- $element = new Zend_Form_Element_Hidden($this->organizationFieldName);
-
- $this->addElement($element);
- }
-
- if (! $this->_organizationFromUrl) {
- $orgIds = array_keys($orgs);
- $orgId = reset($orgIds);
- }
-
- } elseif (! $element instanceof Zend_Form_Element_Select) {
- $element = new Zend_Form_Element_Select($this->organizationFieldName);
- $element->setLabel($this->translate->_('Organization'));
- $element->setRequired(true);
- $element->setMultiOptions($orgs);
-
- if ($this->organizationMaxLines > 1) {
- $element->setAttrib('size', max(count($orgs) + 1, $this->organizationMaxLines));
- }
- $this->addElement($element);
-
- }
- $element->setValue($orgId);
-
- return $element;
- }
-
- /**
* Returns/sets a password element.
*
* @return Zend_Form_Element_Password
@@ -284,41 +142,16 @@
}
/**
- * Return the Request object
+ * Returns the label for the submitbutton
*
- * @return Zend_Controller_Request_Abstract
+ * @return string
*/
- public function getRequest()
+ public function getSubmitButtonLabel()
{
- if (! $this->request) {
- $this->request = Zend_Controller_Front::getInstance()->getRequest();
- }
- return $this->request;
+ return $this->translate->_('Login');
}
/**
- * Returns/sets a submit button.
- *
- * @param string $label
- * @return Zend_Form_Element_Submit
- */
- public function getSubmitButton($label = null)
- {
- $element = $this->getElement($this->_submitFieldName);
-
- if (! $element) {
- // Submit knop
- $element = new Zend_Form_Element_Submit($this->_submitFieldName);
- $element->setLabel(null === $label ? $this->translate->_('Login') : $label);
- $element->setAttrib('class', 'button');
-
- $this->addElement($element);
- }
-
- return $element;
- }
-
- /**
* Returns/sets a link for the token input page.
*
* @return MUtil_Form_Element_Html
@@ -350,58 +183,6 @@
}
/**
- * Returns a user
- *
- * @return Gems_User_User
- */
- public function getUser()
- {
- return $this->_user;
- }
-
- /**
- * Returns/sets a login name element.
- *
- * @return Zend_Form_Element_Text
- */
- public function getUserNameElement()
- {
- $element = $this->getElement($this->usernameFieldName);
-
- if (! $element) {
- // Veld inlognaam
- $element = new Zend_Form_Element_Text($this->usernameFieldName);
- $element->setLabel($this->translate->_('Username'));
- $element->setAttrib('size', 40);
- $element->setRequired(true);
-
- $this->addElement($element);
- }
-
- return $element;
- }
-
- /**
- * Validate the form
- *
- * As it is better for translation utilities to set the labels etc. translated,
- * the MUtil default is to disable translation.
- *
- * However, this also disables the translation of validation messages, which we
- * cannot set translated. The MUtil form is extended so it can make this switch.
- *
- * @param array $data
- * @param boolean $disableTranslateValidators Extra switch
- * @return boolean
- */
- public function isValid($data, $disableTranslateValidators = null)
- {
- $this->_user = $this->loader->getUser($data[$this->usernameFieldName], $data[$this->organizationFieldName]);
-
- return parent::isValid($data, $disableTranslateValidators);
- }
-
- /**
* The function that determines the element load order
*
* @return Gems_User_Form_LoginForm (continuation pattern)
@@ -424,23 +205,6 @@
}
/**
- * For small numbers of organizations a multiline selectbox will be nice. This
- * setting handles how many lines will display at once. Use 1 for the normal
- * dropdown selectbox
- *
- * Enables loading of parameter through Zend_Form::__construct()
- *
- * @param int $organizationMaxLines
- * @return Gems_User_Form_LoginForm (continuation pattern)
- */
- public function setOrganizationMaxLines($organizationMaxLines)
- {
- $this->organizationMaxLines = $organizationMaxLines;
-
- return $this;
- }
-
- /**
* The behaviour for showing a lost password button
*
* Enables loading of parameter through Zend_Form::__construct()
@@ -469,14 +233,4 @@
return $this;
}
-
- /**
- * True when this form was submitted.
- *
- * @return boolean
- */
- public function wasSubmitted()
- {
- return $this->getSubmitButton()->isChecked();
- }
}
Added: trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php
===================================================================
--- trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php (rev 0)
+++ trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php 2012-04-02 17:52:30 UTC (rev 591)
@@ -0,0 +1,327 @@
+<?php
+
+/**
+ * Copyright (c) 2012, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage User
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @version $id: OrganizationFormAbstract.php 203 2012-01-01t 12:51:32Z matijs $
+ */
+
+/**
+ *
+ *
+ * @package Gems
+ * @subpackage User
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5.3
+ */
+abstract class Gems_User_Form_OrganizationFormAbstract extends Gems_Form_AutoLoadFormAbstract implements Gems_User_Validate_GetUserInterface
+{
+ /**
+ * When true the organization was derived from the the url
+ *
+ * @var boolean
+ */
+ protected $_organizationFromUrl = false;
+
+ /**
+ * The field name for the submit element.
+ *
+ * @var string
+ */
+ protected $_submitFieldName = 'button';
+
+ /**
+ *
+ * @var Gems_User_User
+ */
+ protected $_user;
+
+ /**
+ *
+ * @var Gems_Loader
+ */
+ protected $loader;
+
+ /**
+ * The field name for the organization element.
+ *
+ * @var string
+ */
+ public $organizationFieldName = 'organization';
+
+ /**
+ * For small numbers of organizations a multiline selectbox will be nice. This
+ * setting handles how many lines will display at once. Use 1 for the normal
+ * dropdown selectbox
+ *
+ * @var int
+ */
+ protected $organizationMaxLines = 6;
+
+ /**
+ *
+ * @var Zend_Controller_Request_Abstract
+ */
+ protected $request;
+
+ /**
+ *
+ * @var Zend_Translate
+ */
+ protected $translate;
+
+ /**
+ * The field name for the username element.
+ *
+ * @var string
+ */
+ public $usernameFieldName = 'userlogin';
+
+ /**
+ *
+ * @var Zend_Util
+ */
+ protected $util;
+
+
+ /**
+ * Returns the organization id that should currently be used for this form.
+ *
+ * @return int Returns the current organization id, if any
+ */
+ public function getCurrentOrganizationId()
+ {
+ $userLoader = $this->loader->getUserLoader();
+
+ // Url determines organization first.
+ if ($orgId = $userLoader->getOrganizationIdByUrl()) {
+ $this->_organizationFromUrl = true;
+ $userLoader->getCurrentUser()->setCurrentOrganization($orgId);
+ return $orgId;
+ }
+
+ $request = $this->getRequest();
+ if ($request->isPost() && ($orgId = $request->getParam($this->organizationFieldName))) {
+ return $orgId;
+ }
+
+ return $userLoader->getCurrentUser()->getCurrentOrganizationId();
+ }
+
+ /**
+ * Returns a list with the organizations the user can select for login.
+ *
+ * @return array orgId => Name
+ */
+ public function getLoginOrganizations()
+ {
+ return $this->util->getDbLookup()->getOrganizationsForLogin();
+ }
+
+
+ /**
+ * Returns/sets an element for determining / selecting the organization.
+ *
+ * @return Zend_Form_Element_Xhtml
+ */
+ public function getOrganizationElement()
+ {
+ $element = $this->getElement($this->organizationFieldName);
+ $orgId = $this->getCurrentOrganizationId();
+ $orgs = $this->getLoginOrganizations();
+ $hidden = $this->_organizationFromUrl || (count($orgs) < 2);
+
+ if ($hidden) {
+ if (! $element instanceof Zend_Form_Element_Hidden) {
+ $element = new Zend_Form_Element_Hidden($this->organizationFieldName);
+
+ $this->addElement($element);
+ }
+
+ if (! $this->_organizationFromUrl) {
+ $orgIds = array_keys($orgs);
+ $orgId = reset($orgIds);
+ }
+
+ } elseif (! $element instanceof Zend_Form_Element_Select) {
+ $element = new Zend_Form_Element_Select($this->organizationFieldName);
+ $element->setLabel($this->translate->_('Organization'));
+ $element->setRequired(true);
+ $element->setMultiOptions($orgs);
+
+ if ($this->organizationMaxLines > 1) {
+ $element->setAttrib('size', max(count($orgs) + 1, $this->organizationMaxLines));
+ }
+ $this->addElement($element);
+
+ }
+ $element->setValue($orgId);
+
+ return $element;
+ }
+
+ /**
+ * Returns true when the organization element is visible to the user.
+ *
+ * @return boolean
+ */
+ public function getOrganizationIsVisible()
+ {
+ return ! $this->getOrganizationElement() instanceof Zend_Form_Element_Hidden;
+ }
+
+ /**
+ * Return the Request object
+ *
+ * @return Zend_Controller_Request_Abstract
+ */
+ public function getRequest()
+ {
+ if (! $this->request) {
+ $this->request = Zend_Controller_Front::getInstance()->getRequest();
+ }
+ return $this->request;
+ }
+
+ /**
+ * Returns/sets a submit button.
+ *
+ * @return Zend_Form_Element_Submit
+ */
+ public function getSubmitButton()
+ {
+ $element = $this->getElement($this->_submitFieldName);
+
+ if (! $element) {
+ // Submit knop
+ $element = new Zend_Form_Element_Submit($this->_submitFieldName);
+ $element->setLabel($this->getSubmitButtonLabel());
+ $element->setAttrib('class', 'button');
+
+ $this->addElement($element);
+ }
+
+ return $element;
+ }
+
+ /**
+ * Returns the label for the submitbutton
+ *
+ * @return string
+ */
+ abstract public function getSubmitButtonLabel();
+
+ /**
+ * Returns a user
+ *
+ * @return Gems_User_User
+ */
+ public function getUser()
+ {
+ if (! $this->_user) {
+ $request = $this->getRequest();
+
+ $this->_user = $this->loader->getUser($request->getParam($this->usernameFieldName), $request->getParam($this->organizationFieldName));
+ }
+ return $this->_user;
+ }
+
+ /**
+ * Returns/sets a login name element.
+ *
+ * @return Zend_Form_Element_Text
+ */
+ public function getUserNameElement()
+ {
+ $element = $this->getElement($this->usernameFieldName);
+
+ if (! $element) {
+ // Veld inlognaam
+ $element = new Zend_Form_Element_Text($this->usernameFieldName);
+ $element->setLabel($this->translate->_('Username'));
+ $element->setAttrib('size', 40);
+ $element->setRequired(true);
+
+ $this->addElement($element);
+ }
+
+ return $element;
+ }
+
+ /**
+ * Validate the form
+ *
+ * As it is better for translation utilities to set the labels etc. translated,
+ * the MUtil default is to disable translation.
+ *
+ * However, this also disables the translation of validation messages, which we
+ * cannot set translated. The MUtil form is extended so it can make this switch.
+ *
+ * @param array $data
+ * @param boolean $disableTranslateValidators Extra switch
+ * @return boolean
+ */
+ public function isValid($data, $disableTranslateValidators = null)
+ {
+ $this->_user = $this->loader->getUser($data[$this->usernameFieldName], $data[$this->organizationFieldName]);
+
+ return parent::isValid($data, $disableTranslateValidators);
+ }
+
+ /**
+ * For small numbers of organizations a multiline selectbox will be nice. This
+ * setting handles how many lines will display at once. Use 1 for the normal
+ * dropdown selectbox
+ *
+ * Enables loading of parameter through Zend_Form::__construct()
+ *
+ * @param int $organizationMaxLines
+ * @return Gems_User_Form_LoginForm (continuation pattern)
+ */
+ public function setOrganizationMaxLines($organizationMaxLines)
+ {
+ $this->organizationMaxLines = $organizationMaxLines;
+
+ return $this;
+ }
+
+ /**
+ * True when this form was submitted.
+ *
+ * @return boolean
+ */
+ public function wasSubmitted()
+ {
+ return $this->getSubmitButton()->isChecked();
+ }
+}
Added: trunk/library/classes/Gems/User/Form/ResetForm.php
===================================================================
--- trunk/library/classes/Gems/User/Form/ResetForm.php (rev 0)
+++ trunk/library/classes/Gems/User/Form/ResetForm.php 2012-04-02 17:52:30 UTC (rev 591)
@@ -0,0 +1,201 @@
+<?php
+
+/**
+ * Copyright (c) 2012, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage User
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @version $id: ResetForm.php 203 2012-01-01t 12:51:32Z matijs $
+ */
+
+/**
+ *
+ *
+ * @package Gems
+ * @subpackage User
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5.3
+ */
+class Gems_User_Form_ResetForm extends Gems_User_Form_OrganizationFormAbstract
+{
+ /**
+ * The field name for the login link element
+ *
+ * @var string
+ */
+ protected $_loginLinkFieldName = 'loginlink';
+
+ /**
+ * The field name for the reset key element.
+ *
+ * @var string
+ */
+ protected $_resetKeyFieldName = 'key';
+
+ /**
+ * First the password reset is requested (= false), then the reset key is passed (= true)
+ *
+ * @var boolean Calculated when null
+ */
+ protected $hasResetKey = null;
+
+ /**
+ * Returns an html link for the login page.
+ *
+ * @return MUtil_Html_AElement
+ */
+ public function getLoginLink()
+ {
+ return MUtil_Html::create('a', array('controller' => 'index', 'action' => 'login'), $this->translate->_('Back to login'), array('class' => 'actionlink'));
+ }
+
+ /**
+ * Returns a link to the login page
+ *
+ * @return MUtil_Form_Element_Html
+ */
+ public function getLoginLinkElement()
+ {
+ $element = $this->getElement($this->_tokenFieldName);
+
+ if (! $element) {
+ // Login link
+ if ($link = $this->getLoginLink()) {
+ $element = new MUtil_Form_Element_Html($this->_loginLinkFieldName);
+ // $element->br();
+ $element->setValue($link);
+
+ $this->addElement($element);
+ }
+
+ return $element;
+ }
+ }
+
+ /**
+ * Returns an element for keeping a reset key.
+ *
+ * @return Zend_Form_Element_Hidden
+ */
+ public function getResetKeyElement()
+ {
+ $element = $this->getElement($this->_resetKeyFieldName);
+
+ if (! $element) {
+ $element = new Zend_Form_Element_Hidden($this->_resetKeyFieldName);
+
+ $this->addElement($element);
+ }
+
+ return $element;
+ }
+
+ /**
+ * Returns the label for the submitbutton
+ *
+ * @return string
+ */
+ public function getSubmitButtonLabel()
+ {
+ if ($this->hasResetKey()) {
+ return $this->translate->_('Reset password');
+ } else {
+ return $this->translate->_('Request password');
+ }
+ }
+
+ /**
+ * Returns/sets a login name element.
+ *
+ * @return Zend_Form_Element_Text
+ * /
+ public function getUserNameElement()
+ {
+ $element = $this->getElement($this->usernameFieldName);
+
+ if (! $element) {
+ $element = parent::getUserNameElement();
+
+ $element->addValidator(new Gems_User_Validate_ResetKeyValidator($this, $this->translate, $this->_resetKeyFieldName));
+ }
+
+ return $element;
+ }
+
+ /**
+ * Is the form working in reset mode or not
+ *
+ * @return boolean
+ */
+ public function hasResetKey()
+ {
+ if (null === $this->hasResetKey) {
+ $request = $this->getRequest();
+
+ $this->hasResetKey = (boolean) $request->getParam($this->_resetKeyFieldName, false);
+ }
+
+ return $this->hasResetKey;
+ }
+
+ /**
+ * The function that determines the element load order
+ *
+ * @return Gems_User_Form_LoginForm (continuation pattern)
+ */
+ public function loadDefaultElements()
+ {
+ if ($this->hasResetKey()) {
+ $this->getResetKeyElement();
+ }
+ $this->getOrganizationElement();
+ $this->getUserNameElement();
+ $this->getSubmitButton();
+ $this->getLoginLinkElement();
+
+ return $this;
+ }
+
+ /**
+ * Is the form working in reset mode or not
+ *
+ * Enables loading of parameter through Zend_Form::__construct()
+ *
+ * @param boolean $hasKey
+ * @return Gems_User_Form_ResetForm (continuation pattern)
+ */
+ public function setHasResetKey($hasKey = true)
+ {
+ $this->hasResetKey = $hasKey;
+
+ return $this;
+ }
+}
Modified: trunk/library/classes/Gems/User/UserLoader.php
===================================================================
--- trunk/library/classes/Gems/User/UserLoader.php 2012-04-01 23:54:09 UTC (rev 590)
+++ trunk/library/classes/Gems/User/UserLoader.php 2012-04-02 17:52:30 UTC (rev 591)
@@ -301,10 +301,6 @@
{
$args = MUtil_Ra::args(func_get_args());
- if (isset($args['description'])) {
- $args['description'] = sprintf($args['description'], $this->project->getName());
- }
-
$form = $this->_loadClass('Form_LoginForm', true, array($args));
return $form;
@@ -394,6 +390,25 @@
}
/**
+ * Returns a reset form for handling both the incoming request and the outgoing reset request
+ *
+ * @param mixed $args_array MUtil_Ra::args array for LoginForm initiation.
+ * @return Gems_User_Form_ResetForm
+ */
+ public function getResetForm($args_array = null)
+ {
+ $args = MUtil_Ra::args(func_get_args());
+
+ if (isset($args['description'])) {
+ $args['description'] = sprintf($args['description'], $this->project->getName());
+ }
+
+ $form = $this->_loadClass('Form_ResetForm', true, array($args));
+
+ return $form;
+ }
+
+ /**
* Returns a user object, that may be empty if no user exist.
*
* @param string $login_name
Added: trunk/library/classes/Gems/User/Validate/ResetKeyValidator.php
===================================================================
--- trunk/library/classes/Gems/User/Validate/ResetKeyValidator.php (rev 0)
+++ trunk/library/classes/Gems/User/Validate/ResetKeyValidator.php 2012-04-02 17:52:30 UTC (rev 591)
@@ -0,0 +1,129 @@
+<?php
+
+/**
+ * Copyright (c) 2012, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage User
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @version $id: ResetKeyValidator.php 203 2012-01-01t 12:51:32Z matijs $
+ */
+
+/**
+ *
+ *
+ * @package Gems
+ * @subpackage User
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5.3
+ */
+class Gems_User_Validate_ResetKeyValidator implements Zend_Validate_Interface
+{
+ /**
+ * The error message
+ *
+ * @var string
+ */
+ private $_message;
+
+ /**
+ *
+ * @var Gems_User_Validate_GetUserInterface
+ */
+ private $_userSource;
+
+ /**
+ *
+ * @var string
+ */
+ private $fieldName;
+
+ /**
+ *
+ * @var Zend_Translate
+ */
+ private $translate;
+
+ /**
+ *
+ * @param Gems_User_Validate_GetUserInterface $userSource The source for the user
+ * @param Zend_Translate $translate
+ * @param string $fieldName Optional field name (hidden fields are not validated)
+ */
+ public function __construct(Gems_User_Validate_GetUserInterface $userSource, Zend_Translate $translate, $fieldName)
+ {
+ $this->_userSource = $userSource;
+ $this->translate = $translate;
+ $this->fieldName = $fieldName;
+ }
+
+ /**
+ *
+ * @param string $message Default message for standard login fail.
+ */
+ public function getMessages()
+ {
+ return array($this->_message);
+ }
+
+ /**
+ * Returns true if and only if $value meets the validation requirements
+ *
+ * If $value fails validation, then this method returns false, and
+ * getMessages() will return an array of messages that explain why the
+ * validation failed.
+ *
+ * @param mixed $value
+ * @param mixed $content
+ * @return boolean
+ * @throws Zend_Validate_Exception If validation of $value is impossible
+ */
+ public function isValid($value, $context = array())
+ {
+ $this->_message = null;
+
+ $user = $this->_userSource->getUser();
+
+ If ($user->isActive() && $user->canResetPassword()) {
+ $key = isset($context[$this->fieldName]) ? $context[$this->fieldName] : $valid;
+ if ($key) {
+ // Key has been passed by mail
+ if (! $user->checkPasswordResetKey($key)) {
+ $this->_message = $this->translate->_('This key timed out or does not belong to this user.');
+ }
+ }
+ MUtil_Echo::track($key, $context, $this->_message);
+ } else {
+ $this->_message = $this->translate->_('No such user found or no e-mail address known or user cannot be reset.');
+ }
+
+ return (boolean) ! $this->_message;
+ }
+}
Modified: trunk/library/languages/default-en.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-en.po
===================================================================
--- trunk/library/languages/default-en.po 2012-04-01 23:54:09 UTC (rev 590)
+++ trunk/library/languages/default-en.po 2012-04-02 17:52:30 UTC (rev 591)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse EN\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-03-30 22:04+0100\n"
+"POT-Creation-Date: 2012-04-02 19:39+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -1049,7 +1049,6 @@
msgstr "%s records found."
#: classes/Gems/Default/ExportAction.php:172
-#: classes/Gems/Default/IndexAction.php:190
#: classes/Gems/Default/LogAction.php:197
msgid "Organization"
msgstr "Organization"
@@ -1086,54 +1085,64 @@
msgstr "Administrative groups"
#: classes/Gems/Default/IndexAction.php:142
-#, php-format
-msgid "Login to %s application"
-msgstr "Login to %s application"
+msgid "Request password reset"
+msgstr "Request password reset"
-#: classes/Gems/Default/IndexAction.php:161
-msgid "Back to login"
-msgstr "Back to login"
+#: classes/Gems/Default/IndexAction.php:143
+msgid "We received your password reset request. "
+msgstr "We received your password reset request. "
-#: classes/Gems/Default/IndexAction.php:212
-#, php-format
-msgid "Reset password for %s application"
-msgstr "Reset password for %s application"
+#: classes/Gems/Default/IndexAction.php:146
+msgid "Please enter the organization and username/e-mail address belonging to this request."
+msgstr "Please enter the organization and username/e-mail address belonging to this request."
-#: classes/Gems/Default/IndexAction.php:216
-msgid "Reset password"
-msgstr "Reset password"
+#: classes/Gems/Default/IndexAction.php:148
+msgid "Please enter the username or e-mail address belonging to this request."
+msgstr "Please enter the username or e-mail address belonging to this request."
-#: classes/Gems/Default/IndexAction.php:262
-msgid "Username"
-msgstr "Username"
+#: classes/Gems/Default/IndexAction.php:151
+msgid "Execute password reset"
+msgstr "Execute password reset"
-#: classes/Gems/Default/IndexAction.php:294
+#: classes/Gems/Default/IndexAction.php:155
+msgid "Please enter your organization and your username or e-mail address. "
+msgstr "Please enter your organization and your username or e-mail address. "
+
+#: classes/Gems/Default/IndexAction.php:157
+msgid "Please enter your username or e-mail address. "
+msgstr "Please enter your username or e-mail address. "
+
+#: classes/Gems/Default/IndexAction.php:159
+msgid "We will then send you an e-mail with a link you can use to reset your password."
+msgstr "We will then send you an e-mail with a link you can use to reset your password."
+
+#: classes/Gems/Default/IndexAction.php:193
msgid "Your password must be changed."
msgstr "Your password must be changed."
-#: classes/Gems/Default/IndexAction.php:306
+#: classes/Gems/Default/IndexAction.php:205
#, php-format
msgid "Login successful, welcome %s."
msgstr "Login successful, welcome %s."
-#: classes/Gems/Default/IndexAction.php:348
+#: classes/Gems/Default/IndexAction.php:248
#, php-format
msgid "Good bye: %s."
msgstr "Good bye: %s."
-#: classes/Gems/Default/IndexAction.php:373
+#: classes/Gems/Default/IndexAction.php:274
msgid "Reset accepted, enter your new password."
msgstr "Reset accepted, enter your new password."
-#: classes/Gems/Default/IndexAction.php:377
+#: classes/Gems/Default/IndexAction.php:278
msgid "This key timed out or does not belong to this user."
msgstr "This key timed out or does not belong to this user."
-#: classes/Gems/Default/IndexAction.php:380
+#: classes/Gems/Default/IndexAction.php:281
msgid "Password reset requested"
msgstr "Password reset requested"
-#: classes/Gems/Default/IndexAction.php:381
+#: classes/Gems/Default/IndexAction.php:282
msgid ""
"To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n"
"{reset_url}"
@@ -1141,22 +1150,14 @@
"To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n"
"{reset_url}"
-#: classes/Gems/Default/IndexAction.php:386
+#: classes/Gems/Default/IndexAction.php:287
msgid "We sent you an e-mail with a reset link. Click on the link in the e-mail."
msgstr "We sent you an e-mail with a reset link. Click on the link in the e-mail."
-#: classes/Gems/Default/IndexAction.php:391
+#: classes/Gems/Default/IndexAction.php:291
msgid "No such user found or no e-mail address known or user cannot be reset."
msgstr "No such user found or no e-mail address known or user cannot be reset."
-#: classes/Gems/Default/IndexAction.php:395
-msgid "We received your password reset key."
-msgstr "We received your password reset key."
-
-#: classes/Gems/Default/IndexAction.php:396
-msgid "Please enter the organization and username belonging to this key."
-msgstr "Please enter the organization and username belonging to this key."
-
#: classes/Gems/Default/InvitationAction.php:52
msgid "Invite"
msgstr "Invite"
@@ -1476,30 +1477,30 @@
msgid "New password is active."
msgstr "New password is active."
-#: classes/Gems/Default/OptionAction.php:128
+#: classes/Gems/Default/OptionAction.php:129
msgid "Login Name"
msgstr "Login Name"
-#: classes/Gems/Default/OptionAction.php:135
+#: classes/Gems/Default/OptionAction.php:136
#: classes/Gems/Default/OrganizationAction.php:132
#: classes/Gems/Default/RespondentAction.php:175
msgid "Language"
msgstr "Language"
-#: classes/Gems/Default/OptionAction.php:145
+#: classes/Gems/Default/OptionAction.php:146
#, php-format
msgid "Options"
msgstr "Options"
-#: classes/Gems/Default/OptionAction.php:154
+#: classes/Gems/Default/OptionAction.php:155
msgid "This overview provides information about the last login activity on your account."
msgstr "This overview provides information about the last login activity on your account."
-#: classes/Gems/Default/OptionAction.php:174
+#: classes/Gems/Default/OptionAction.php:175
msgid "Date / time"
msgstr "Date / time"
-#: classes/Gems/Default/OptionAction.php:185
+#: classes/Gems/Default/OptionAction.php:186
msgid "Item"
msgstr "Item"
@@ -2852,6 +2853,10 @@
msgid "Clean cache"
msgstr "Clean cache"
+#: classes/Gems/Menu/MenuAbstract.php:390
+msgid "Reset password"
+msgstr "Reset password"
+
#: classes/Gems/Menu/MenuAbstract.php:416
msgid "Check status"
msgstr "Check status"
@@ -3674,18 +3679,30 @@
msgid "Caps Lock seems to be on!"
msgstr "Caps Lock seems to be on!"
-#: classes/Gems/User/Form/LoginForm.php:274
+#: classes/Gems/User/Form/LoginForm.php:132
msgid "Combination of user and password not found."
msgstr "Combination of user and password not found."
-#: classes/Gems/User/Form/LoginForm.php:276
+#: classes/Gems/User/Form/LoginForm.php:134
msgid "Combination of user and password not found for this organization."
msgstr "Combination of user and password not found for this organization."
-#: classes/Gems/User/Form/LoginForm.php:349
+#: classes/Gems/User/Form/LoginForm.php:182
msgid "Enter your token..."
msgstr "Enter your token..."
+#: classes/Gems/User/Form/OrganizationFormAbstract.php:271
+msgid "Username"
+msgstr "Username"
+
+#: classes/Gems/User/Form/ResetForm.php:77
+msgid "Back to login"
+msgstr "Back to login"
+
+#: classes/Gems/User/Form/ResetForm.php:131
+msgid "Request password"
+msgstr "Request password"
+
#: classes/Gems/Util/ReceptionCodeLibrary.php:100
msgid "Yes (forget answers)"
msgstr "Yes (forget answers)"
@@ -4039,6 +4056,7 @@
msgstr "Lists choices changed."
#: snippets/EditSingleSurveyTokenSnippet.php:132
+#: snippets/ShowSingleSurveyTokenSnippet.php:150
msgid "Show survey"
msgstr "Show survey"
@@ -4176,6 +4194,12 @@
msgid "Can access"
msgstr "Can access"
+#~ msgid "Login to %s application"
+#~ msgstr "Login to %s application"
+
+#~ msgid "Reset password for %s application"
+#~ msgstr "Reset password for %s application"
+
#~ msgid "To reset your password for %s, please click this link: %s"
#~ msgstr "To reset your password for %s, please click this link: %s"
Modified: trunk/library/languages/default-nl.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-nl.po
===================================================================
--- trunk/library/languages/default-nl.po 2012-04-01 23:54:09 UTC (rev 590)
+++ trunk/library/languages/default-nl.po 2012-04-02 17:52:30 UTC (rev 591)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse NL\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-03-30 22:04+0100\n"
+"POT-Creation-Date: 2012-04-02 19:39+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -1049,7 +1049,6 @@
msgstr "%s records gevonden."
#: classes/Gems/Default/ExportAction.php:172
-#: classes/Gems/Default/IndexAction.php:190
#: classes/Gems/Default/LogAction.php:197
msgid "Organization"
msgstr "Organisatie"
@@ -1086,54 +1085,64 @@
msgstr "Beheer groepen"
#: classes/Gems/Default/IndexAction.php:142
-#, php-format
-msgid "Login to %s application"
-msgstr "%s login"
+msgid "Request password reset"
+msgstr "Wachtwoord vergeten?"
-#: classes/Gems/Default/IndexAction.php:161
-msgid "Back to login"
-msgstr "Terug naar de login"
+#: classes/Gems/Default/IndexAction.php:143
+msgid "We received your password reset request. "
+msgstr "We hebben uw verzoek om een nieuw wachtwoord ontvangen."
-#: classes/Gems/Default/IndexAction.php:212
-#, php-format
-msgid "Reset password for %s application"
-msgstr "Reset wachtwoord voor %s"
+#: classes/Gems/Default/IndexAction.php:146
+msgid "Please enter the organization and username/e-mail address belonging to this request."
+msgstr "Voer de organisatie en de gebruikersnaam of het e-mail adres in die bij dit verzoek horen."
-#: classes/Gems/Default/IndexAction.php:216
-msgid "Reset password"
-msgstr "Reset wachtwoord"
+#: classes/Gems/Default/IndexAction.php:148
+msgid "Please enter the username or e-mail address belonging to this request."
+msgstr "Voer de gebruikersnaam of het e-mail adres in die bij dit verzoek horen."
-#: classes/Gems/Default/IndexAction.php:262
-msgid "Username"
-msgstr "Gebruikersnaam"
+#: classes/Gems/Default/IndexAction.php:151
+msgid "Execute password reset"
+msgstr "Vervang vergeten passwood"
-#: classes/Gems/Default/IndexAction.php:294
+#: classes/Gems/Default/IndexAction.php:155
+msgid "Please enter your organization and your username or e-mail address. "
+msgstr "Geef uw organisatie en uw email adres of de gebruikersnaam op."
+
+#: classes/Gems/Default/IndexAction.php:157
+msgid "Please enter your username or e-mail address. "
+msgstr "Geef uw email adres of gebruikersnaam op."
+
+#: classes/Gems/Default/IndexAction.php:159
+msgid "We will then send you an e-mail with a link you can use to reset your password."
+msgstr "Daarna sturen wij een een email met een link waarmee u uw wachtwoord kan vervangen."
+
+#: classes/Gems/Default/IndexAction.php:193
msgid "Your password must be changed."
msgstr "Uw wachtwoord moet veranderd worden."
-#: classes/Gems/Default/IndexAction.php:306
+#: classes/Gems/Default/IndexAction.php:205
#, php-format
msgid "Login successful, welcome %s."
msgstr "Login in orde, welkom %s."
-#: classes/Gems/Default/IndexAction.php:348
+#: classes/Gems/Default/IndexAction.php:248
#, php-format
msgid "Good bye: %s."
msgstr "Tot ziens: %s."
-#: classes/Gems/Default/IndexAction.php:373
+#: classes/Gems/Default/IndexAction.php:274
msgid "Reset accepted, enter your new password."
msgstr "Reset geaccepteerd, voer uw nieuwe wachtwoord in."
-#: classes/Gems/Default/IndexAction.php:377
+#: classes/Gems/Default/IndexAction.php:278
msgid "This key timed out or does not belong to this user."
msgstr "Te oude sleutel of sleutel hoort niet bij gebruiker."
-#: classes/Gems/Default/IndexAction.php:380
+#: classes/Gems/Default/IndexAction.php:281
msgid "Password reset requested"
msgstr "Wachtwoord reset aangevraagd"
-#: classes/Gems/Default/IndexAction.php:381
+#: classes/Gems/Default/IndexAction.php:282
msgid ""
"To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n"
"{reset_url}"
@@ -1141,22 +1150,14 @@
"Om een nieuw wachtwoord in te stellen voor de [b]{organization}[/b] site [b]{project}[/b], klik op deze link:\n"
"{reset_url}"
-#: classes/Gems/Default/IndexAction.php:386
+#: classes/Gems/Default/IndexAction.php:287
msgid "We sent you an e-mail with a reset link. Click on the link in the e-mail."
msgstr "We hebben u een email met reset link gestuurd. Klik op de link in de email."
-#: classes/Gems/Default/IndexAction.php:391
+#: classes/Gems/Default/IndexAction.php:291
msgid "No such user found or no e-mail address known or user cannot be reset."
msgstr "Gebruiker niet gevonden of e-mail adres onbekend of gebruiker kan niet gereset worden."
-#: classes/Gems/Default/IndexAction.php:395
-msgid "We received your password reset key."
-msgstr "Wachtwoord resetsleutel ontvangen."
-
-#: classes/Gems/Default/IndexAction.php:396
-msgid "Please enter the organization and username belonging to this key."
-msgstr "Geef de organisatie en gebruikersnaam die bij deze sleutel horen op."
-
#: classes/Gems/Default/InvitationAction.php:52
msgid "Invite"
msgstr "Uitnodigen"
@@ -1476,30 +1477,30 @@
msgid "New password is active."
msgstr "Nieuwe wachtwoord geactiveerd."
-#: classes/Gems/Default/OptionAction.php:128
+#: classes/Gems/Default/OptionAction.php:129
msgid "Login Name"
msgstr "Login Naam"
-#: classes/Gems/Default/OptionAction.php:135
+#: classes/Gems/Default/OptionAction.php:136
#: classes/Gems/Default/OrganizationAction.php:132
#: classes/Gems/Default/RespondentAction.php:175
msgid "Language"
msgstr "Taal"
-#: classes/Gems/Default/OptionAction.php:145
+#: classes/Gems/Default/OptionAction.php:146
#, php-format
msgid "Options"
msgstr "Instellingen"
-#: classes/Gems/Default/OptionAction.php:154
+#: classes/Gems/Default/OptionAction.php:155
msgid "This overview provides information about the last login activity on your account."
msgstr "Dit overzicht geeft informatie over de recente inlog activiteit op uw account."
-#: classes/Gems/Default/OptionAction.php:174
+#: classes/Gems/Default/OptionAction.php:175
msgid "Date / time"
msgstr "Datum / tijd"
-#: classes/Gems/Default/OptionAction.php:185
+#: classes/Gems/Default/OptionAction.php:186
msgid "Item"
msgstr "Item"
@@ -2852,6 +2853,10 @@
msgid "Clean cache"
msgstr "Cache opruimen"
+#: classes/Gems/Menu/MenuAbstract.php:390
+msgid "Reset password"
+msgstr "Reset wachtwoord"
+
#: classes/Gems/Menu/MenuAbstract.php:416
msgid "Check status"
msgstr "Status controle"
@@ -3674,18 +3679,30 @@
msgid "Caps Lock seems to be on!"
msgstr "De Caps Lock toets lijkt aan te staan!"
-#: classes/Gems/User/Form/LoginForm.php:274
+#: classes/Gems/User/Form/LoginForm.php:132
msgid "Combination of user and password not found."
msgstr "Combinatie van gebruikersnaam en wachtwoord niet gevonden."
-#: classes/Gems/User/Form/LoginForm.php:276
+#: classes/Gems/User/Form/LoginForm.php:134
msgid "Combination of user and password not found for this organization."
msgstr "Combinatie van organisatie, gebruikersnaam en wachtwoord niet gevonden."
-#: classes/Gems/User/Form/LoginForm.php:349
+#: classes/Gems/User/Form/LoginForm.php:182
msgid "Enter your token..."
msgstr "Voer uw kenmerk in..."
+#: classes/Gems/User/Form/OrganizationFormAbstract.php:271
+msgid "Username"
+msgs...
[truncated message content] |