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.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.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.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. 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. 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. 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 * @param user see user.js
*/ */
reccordLoginCookie=function(user) { 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(){ getUserFromLoginCookie=function(){

View File

@ -421,11 +421,11 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) {
changePasswordBox(true,false,user); changePasswordBox(true,false,user);
return; 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){ if (user.locked()==true){
$.log("user locked"); $.log("user locked");
displayErrorMessage($.i18n.prop("account.locked")); displayErrorMessage($.i18n.prop("account.locked"));
return return;
} }
// FIXME check validated // FIXME check validated
@ -435,6 +435,7 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) {
} }
$.log("user.rememberme:"+(user.rememberme)); $.log("user.rememberme:"+(user.rememberme));
reccordLoginCookie(user); reccordLoginCookie(user);
window.user=user;
$("#login-link").hide(); $("#login-link").hide();
$("#logout-link").show(); $("#logout-link").show();
$("#register-link").hide(); $("#register-link").hide();
@ -582,11 +583,9 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) {
} }
$("#modal-login-ok").button("loading"); $("#modal-login-ok").button("loading");
//#modal-login-footer
$('#modal-login-footer').append(smallSpinnerImg()); $('#modal-login-footer').append(smallSpinnerImg());
var rememberme=($("#user-login-form-rememberme" ).attr('checked')=='checked'); var rememberme=($("#user-login-form-rememberme" ).attr('checked')=='checked');
$.log("rememberme:"+rememberme);
window.redbackModel.rememberme=rememberme; window.redbackModel.rememberme=rememberme;
window.redbackModel.password=$("#user-login-form-password").val(); window.redbackModel.password=$("#user-login-form-password").val();