[gen] Implemented a mechanism 'forgot password?'.

This commit is contained in:
Gaetan Delannay 2012-07-09 15:47:38 +02:00
parent 8a5ca81746
commit ad14c1258c
6 changed files with 139 additions and 17 deletions

View file

@ -67,6 +67,7 @@ img { border: 0; vertical-align: middle}
border-radius: 2px 2px 2px 2px; box-shadow: 0 2px 4px #A9A9A9;}
.focus td { padding: 4px 0px 4px 4px }
.discreet { font-size: 90%; }
.lostPassword a { font-size: 90%; color: white; padding-left: 1em;}
.portlet { width: 150px; border-right: 1px solid #5F7983;}
.portletContent { margin: 9px; }
.portletTitle { font-weight: bold; font-size: 110%; margin-bottom: 4px;}

View file

@ -451,6 +451,19 @@ function doConfirm() {
}
}
var wrongTextInput = '#ff934a none';
// Function triggered when the user ask password reinitialisation
function doAskPasswordReinit() {
// Check that the user has typed a login
var theForm = document.getElementById('askPasswordReinitForm');
var login = theForm.login.value.replace(' ', '');
if (!login) { theForm.login.style.background = wrongTextInput; }
else {
closePopup('askPasswordReinitPopup');
theForm.submit();
}
}
// Function that finally posts the edit form after the user has confirmed that
// she really wants to post it.
function postConfirmedEditForm() {

View file

@ -78,7 +78,7 @@
<div id="grey" class="grey"></div>
<tal:comment replace="nothing">Popup for confirming an action</tal:comment>
<div id="confirmActionPopup" class="popup">
<div id="confirmActionPopup" class="popup">
<form id="confirmActionForm" method="post">
<div align="center">
<p id="appyConfirmText"></p>
@ -96,7 +96,22 @@
tal:attributes="value python:_('no')"/>
</div>
</form>
</div>
</div>
<tal:comment replace="nothing">Popup for reinitialing the password</tal:comment>
<div id="askPasswordReinitPopup" class="popup" tal:condition="isAnon">
<form id="askPasswordReinitForm" method="post"
tal:attributes="action python: tool.absolute_url() + '/askPasswordReinit'">
<div align="center">
<p tal:content="python: _('app_login')"></p>
<input type="text" size="35" name="login" id="login" value=""/>
<br/><br/>
<input type="button" onClick="doAskPasswordReinit()"
tal:attributes="value python:_('ask_password_reinit')"/>
<input type="button" value="No" onClick="closePopup('askPasswordReinitPopup')"
tal:attributes="value python:_('object_cancel')"/>
</div>
</form>
</div>
</td>
</tr>
<tal:comment replace="nothing">The user strip</tal:comment>
@ -108,23 +123,28 @@
<tal:comment replace="nothing">The user login form for anonymous users</tal:comment>
<table align="center" tal:condition="python: isAnon and ('/temp_folder/' not in req['ACTUAL_URL'])"
class="login">
<tr><td class="userStripText">
<form name="loginform" method="post"
<tr>
<td class="userStripText">
<form name="loginform" method="post"
tal:attributes="action python: tool.absolute_url() + '/performLogin'">
<input type="hidden" name="js_enabled" id="js_enabled" value="0"/>
<input type="hidden" name="cookies_enabled" id="cookies_enabled" value=""/>
<input type="hidden" name="login_name" id="login_name" value=""/>
<input type="hidden" name="pwd_empty" id="pwd_empty" value="0"/>
<input type="hidden" name="js_enabled" id="js_enabled" value="0"/>
<input type="hidden" name="cookies_enabled" id="cookies_enabled" value=""/>
<input type="hidden" name="login_name" id="login_name" value=""/>
<input type="hidden" name="pwd_empty" id="pwd_empty" value="0"/>
<span tal:replace="python: _('app_login')"/>&nbsp;
<input type="text" size="25" name="__ac_name" id="__ac_name" value=""/>&nbsp;
<span tal:replace="python: _('app_password')"/>&nbsp;
<input type="password" size="25" name="__ac_password" id="__ac_password"/>
<input type="submit" name="submit" onclick="setLoginVars()"
tal:define="label python: _('app_connect')" tal:attributes="value label; alt label;"/>
</form>
</td></tr>
<span tal:replace="python: _('app_login')"/>&nbsp;
<input type="text" size="25" name="__ac_name" id="__ac_name" value=""/>&nbsp;
<span tal:replace="python: _('app_password')"/>&nbsp;
<input type="password" size="25" name="__ac_password" id="__ac_password"/>
<input type="submit" name="submit" onclick="setLoginVars()"
tal:define="label python: _('app_connect')" tal:attributes="value label; alt label;"/>
</form>
</td>
<td class="lostPassword">
<a href="javascript: openPopup('askPasswordReinitPopup')"
tal:content="python: _('forgot_password')"></a></td>
</tr>
</table>
<tal:comment replace="nothing">User info and controls for authenticated users</tal:comment>
<table tal:condition="not: isAnon" class="buttons" width="99%">