allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [4/8] git commit: [#7372] ticket:583 Add form for asking password
Date Tue, 27 May 2014 22:00:01 GMT
[#7372] ticket:583 Add form for asking password


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

Branch: refs/heads/master
Commit: 9a9c3f6dd863bca2eba174528e5f549569b74dbd
Parents: a6277fb
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Thu May 15 11:30:00 2014 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri May 23 18:02:37 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py                 | 5 ++++-
 Allura/allura/lib/widgets/__init__.py             | 2 +-
 Allura/allura/lib/widgets/auth_widgets.py         | 7 +++++++
 Allura/allura/templates/user_disable_account.html | 5 +++++
 Allura/allura/tests/functional/test_auth.py       | 5 +++++
 5 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/9a9c3f6d/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 9d0af06..9bbaa23 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -39,7 +39,8 @@ from allura.lib.widgets import (
     OAuthApplicationForm,
     OAuthRevocationForm,
     LoginForm,
-    ForgottenPasswordForm)
+    ForgottenPasswordForm,
+    DisableAccountForm)
 from allura.lib.widgets import forms
 from allura.controllers import BaseController
 
@@ -67,6 +68,7 @@ class F(object):
     remove_inactive_period_form = forms.RemoveInactivePeriodForm()
     save_skill_form = forms.AddUserSkillForm()
     remove_skill_form = forms.RemoveSkillForm()
+    disable_accont_form = DisableAccountForm()
 
 
 class AuthController(BaseController):
@@ -862,4 +864,5 @@ class DisableAccountController(BaseController):
         return {
             'menu': menu,
             'my_projects': my_projects,
+            'form': F.disable_accont_form,
         }

http://git-wip-us.apache.org/repos/asf/allura/blob/9a9c3f6d/Allura/allura/lib/widgets/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/__init__.py b/Allura/allura/lib/widgets/__init__.py
index cef0d29..6e13a39 100644
--- a/Allura/allura/lib/widgets/__init__.py
+++ b/Allura/allura/lib/widgets/__init__.py
@@ -18,5 +18,5 @@
 from .discuss import Post, Thread, Discussion
 from .subscriptions import SubscriptionForm
 from .oauth_widgets import OAuthApplicationForm, OAuthRevocationForm
-from .auth_widgets import LoginForm, ForgottenPasswordForm
+from .auth_widgets import LoginForm, ForgottenPasswordForm, DisableAccountForm
 from .vote import VoteForm

http://git-wip-us.apache.org/repos/asf/allura/blob/9a9c3f6d/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 034da45..b46ff21 100644
--- a/Allura/allura/lib/widgets/auth_widgets.py
+++ b/Allura/allura/lib/widgets/auth_widgets.py
@@ -77,3 +77,10 @@ class ForgottenPasswordForm(ForgeForm):
                 'Unable to recover password for this email',
                 {'email': email}, None)
         return value
+
+
+class DisableAccountForm(ForgeForm):
+    submit_text = 'Disable'
+
+    class fields(ew_core.NameList):
+        password = ew.PasswordField(name='password', label='Account password')

http://git-wip-us.apache.org/repos/asf/allura/blob/9a9c3f6d/Allura/allura/templates/user_disable_account.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/user_disable_account.html b/Allura/allura/templates/user_disable_account.html
index 746f1be..502ef18 100644
--- a/Allura/allura/templates/user_disable_account.html
+++ b/Allura/allura/templates/user_disable_account.html
@@ -38,5 +38,10 @@
       </ul>
     </p>
     {% endif %}
+    <p>
+    Are you really sure you want to disable your account?
+    If so, enter account password below to confirm.
+    </p>
+    {{ form.display(action='do_disable') }}
   </div>
 {% endblock %}

http://git-wip-us.apache.org/repos/asf/allura/blob/9a9c3f6d/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index f4f773a..8483cda 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -1048,3 +1048,8 @@ class TestDisableAccount(TestController):
         for p in user.my_projects_by_role_name('Admin'):
             assert_in(p.name, r)
             assert_in(p.url(), r)
+
+    def test_has_asks_password(self):
+        r = self.app.get('/auth/disable/')
+        form = r.html.find('form', {'action': 'do_disable'})
+        assert form is not None


Mime
View raw message