You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/11/07 22:07:17 UTC

[04/14] git commit: [#6783] ticket:463 added properties to make process optionial

[#6783] ticket:463 added properties to make process optionial


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

Branch: refs/heads/master
Commit: 5afc37306fb636eee8150dc2521b265ef7e64594
Parents: 8b662d0
Author: coldmind <so...@yandex.ru>
Authored: Fri Oct 25 18:20:10 2013 +0300
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Nov 7 21:05:02 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py         |  2 ++
 Allura/allura/lib/plugin.py               | 12 +++++-------
 Allura/allura/lib/widgets/auth_widgets.py |  3 ++-
 3 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5afc3730/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index c6f9f88..9ecab1c 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -159,6 +159,8 @@ class AuthController(BaseController):
 
     @expose('jinja:allura:templates/forgotten_password.html')
     def forgotten_password(self, hash=None, **kw):
+        if not plugin.LocalAuthenticationProvider.forgotten_password_process:
+            redirect('/')
         if not hash:
             c.forgotten_password_form = F.forgotten_password_form
         else:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5afc3730/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index bbdcac4..cd92cf3 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -68,7 +68,7 @@ class AuthenticationProvider(object):
 
     def __init__(self, request):
         self.request = request
-        #self.forgotten_password_process = False
+    forgotten_password_process = False
 
     @classmethod
     def get(cls, request):
@@ -84,9 +84,9 @@ class AuthenticationProvider(object):
     def session(self):
         return self.request.environ['beaker.session']
 
-    #@LazyProperty
-    #def forgotten_password(self):
-    #    return self.forgotten_password_process
+    @LazyProperty
+    def forgotten_password(self):
+        return self.forgotten_password_process
 
     def authenticate_request(self):
         from allura import model as M
@@ -218,9 +218,7 @@ class LocalAuthenticationProvider(AuthenticationProvider):
     Stores user passwords on the User model, in mongo.  Uses per-user salt and
     SHA-256 encryption.
     '''
-    #def __init__(self, *args, **kwargs):
-    #    super(AuthenticationProvider, self).__init__(*args, **kwargs)
-    #    self.forgotten_password_process = True
+    forgotten_password_process = True
 
     def register_user(self, user_doc):
         from allura import model as M

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5afc3730/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 45f3a74..8a4dba3 100644
--- a/Allura/allura/lib/widgets/auth_widgets.py
+++ b/Allura/allura/lib/widgets/auth_widgets.py
@@ -34,7 +34,8 @@ class LoginForm(ForgeForm):
     class fields(ew_core.NameList):
         username = ew.TextField(label='Username')
         password = ew.PasswordField(label='Password')
-        link = ew.HTMLField(text='<a href="forgotten_password">Forgot password?</a>')
+        if plugin.LocalAuthenticationProvider.forgotten_password_process:
+            link = ew.HTMLField(text='<a href="./forgotten_password">Forgot password?</a>')
 
     class hidden_fields(ew_core.NameList):
         return_to = ew.HiddenField()