more options for rememberme cookie settings

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1424231 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-12-19 23:47:13 +00:00
parent 249e6dddc5
commit 95fd5712ed
3 changed files with 21 additions and 6 deletions

View File

@ -566,7 +566,10 @@ ldap.config.max.result.count.help.content=Maximum of result when searching users
security.policy.password.rule.numericalcount.enabled.help.content=Minimum of number characters in the password.
security.policy.allowed.login.attempt.help.content=Maximum number of login attempt before loking account.
security.rememberme.enabled.help.content=Enable rememberme on login.
security.rememberme.timeout.help.content=Timeout in minutes for rememberme cookie.
security.rememberme.timeout.help.content=Timeout in days for rememberme cookie.
security.rememberme.path.help.content=Path for rememberme cookie.
security.rememberme.secure.help.content=rememberme cookie secured.
security.rememberme.domain.help.content=rememberme cookie domain.
security.policy.unlockable.accounts.help.content=Non lockable accounts.
ldap.config.mapper.attribute.fullname.help.content=The name of the attribute on a user that contains the users fullName.
security.policy.password.rule.characterlength.enabled.help.content=Character length password rule enabled.

View File

@ -28,7 +28,20 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
* @param user see user.js
*/
reccordLoginCookie=function(user) {
$.cookie('archiva_login', ko.toJSON(user),{ expires: 7, path: '/' });
var path = window.redbackRuntimeConfiguration.findPropertyValue("security.rememberme.timeout");
path = path ? path : "/";
var domain = window.redbackRuntimeConfiguration.findPropertyValue("security.rememberme.domain");
var secure = window.redbackRuntimeConfiguration.findPropertyValue("security.rememberme.secure");
$.cookie('archiva_login', ko.toJSON(user),
{
expires: Number(window.redbackRuntimeConfiguration.findPropertyValue("security.rememberme.timeout")),
path: path,
domain: domain,
secure: secure
}
);
};
getUserFromLoginCookie=function(){

View File

@ -421,11 +421,11 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) {
changePasswordBox(true,false,user);
return;
}
// not really needed as an exception is returned but "ceintures et bretelles" as we said in French :-)
// not really needed as an exception is returned but "ceintures et bretelles" as we say in French :-)
if (user.locked()==true){
$.log("user locked");
displayErrorMessage($.i18n.prop("account.locked"));
return
return;
}
// FIXME check validated
@ -435,6 +435,7 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) {
}
$.log("user.rememberme:"+(user.rememberme));
reccordLoginCookie(user);
window.user=user;
$("#login-link").hide();
$("#logout-link").show();
$("#register-link").hide();
@ -582,11 +583,9 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) {
}
$("#modal-login-ok").button("loading");
//#modal-login-footer
$('#modal-login-footer').append(smallSpinnerImg());
var rememberme=($("#user-login-form-rememberme" ).attr('checked')=='checked');
$.log("rememberme:"+rememberme);
window.redbackModel.rememberme=rememberme;
window.redbackModel.password=$("#user-login-form-password").val();