You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2014/07/25 09:55:21 UTC

[18/28] git commit: [#7451] ticket:605 Added Remember me option to login form

[#7451] ticket:605 Added Remember me option to login form


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/798a40cb
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/798a40cb
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/798a40cb

Branch: refs/heads/je/42cc_7451
Commit: 798a40cb6952b2fedbd475fb5fcee1076e82b0aa
Parents: 2e1735c
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Mon Jul 14 21:17:39 2014 +0300
Committer: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Committed: Thu Jul 24 22:14:46 2014 +0300

----------------------------------------------------------------------
 Allura/allura/lib/plugin.py               | 4 ++++
 Allura/allura/lib/widgets/auth_widgets.py | 1 +
 2 files changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/798a40cb/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index a5c3f65..cd8419d 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -141,6 +141,10 @@ class AuthenticationProvider(object):
             self.session['userid'] = user._id
             if self.is_password_expired(user):
                 self.session['pwd-expired'] = True
+            if 'rememberme' in self.request.params:
+                self.session.cookie_expires = datetime.now() + timedelta(365)
+            else:
+                self.session.cookie_expires = True
             self.session.save()
             g.zarkov_event('login', user=user)
             g.statsUpdater.addUserLogin(user)

http://git-wip-us.apache.org/repos/asf/allura/blob/798a40cb/Allura/allura/lib/widgets/auth_widgets.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/auth_widgets.py b/Allura/allura/lib/widgets/auth_widgets.py
index 567cd54..7ea416f 100644
--- a/Allura/allura/lib/widgets/auth_widgets.py
+++ b/Allura/allura/lib/widgets/auth_widgets.py
@@ -38,6 +38,7 @@ class LoginForm(ForgeForm):
         fields = [
             ew.TextField(name='username', label='Username'),
             ew.PasswordField(name='password', label='Password'),
+            ew.Checkbox(name='rememberme', label='Remember Me'),
             ew.HiddenField(name='return_to'),
         ]
         if plugin.AuthenticationProvider.get(request).forgotten_password_process: