Merge lp:~salgado/launchpad/bug-532669 into lp:launchpad

Proposed by Guilherme Salgado
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~salgado/launchpad/bug-532669
Merge into: lp:launchpad
Diff against target: 112 lines (+3/-42)
3 files modified
lib/lp/registry/browser/person.py (+2/-17)
lib/lp/registry/stories/person/xx-deactivate-account.txt (+1/-20)
lib/lp/registry/templates/person-deactivate-account.pt (+0/-5)
To merge this branch: bzr merge lp:~salgado/launchpad/bug-532669
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+21443@code.launchpad.net

Description of the change

Remove the password field from +deactivate-account as soon enough we
won't even have access to the account's password, not to mention that it
wouldn't make any sense as the account password is the OpenID provider's
business and we're just a consumer.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/registry/templates/person-deactivate-account.pt
  lib/lp/registry/stories/person/xx-deactivate-account.txt
  lib/lp/registry/browser/person.py

== Pylint notices ==

lib/lp/registry/browser/person.py
    117: [F0401] Unable to import 'lazr.delegates' (No module named delegates)
    118: [F0401] Unable to import 'lazr.config' (No module named config)
    119: [F0401] Unable to import 'lazr.restful.interface' (No module named restful)
    120: [F0401] Unable to import 'lazr.restful.interfaces' (No module named restful)
    230: [F0401] Unable to import 'lazr.uri' (No module named uri)

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py 2010-03-13 00:32:40 +0000
+++ lib/lp/registry/browser/person.py 2010-03-16 13:03:31 +0000
@@ -1,7 +1,7 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4# pylint: disable-msg=E0211,E02134# pylint: disable-msg=E0211,E0213,C0322
55
6"""Person-related view classes."""6"""Person-related view classes."""
77
@@ -116,7 +116,7 @@
116from canonical.config import config116from canonical.config import config
117from lazr.delegates import delegates117from lazr.delegates import delegates
118from lazr.config import as_timedelta118from lazr.config import as_timedelta
119from lazr.restful.interface import copy_field, use_template119from lazr.restful.interface import copy_field
120from lazr.restful.interfaces import IWebServiceClientRequest120from lazr.restful.interfaces import IWebServiceClientRequest
121from canonical.lazr.utils import safe_hasattr121from canonical.lazr.utils import safe_hasattr
122from canonical.database.sqlbase import flush_database_updates122from canonical.database.sqlbase import flush_database_updates
@@ -221,7 +221,6 @@
221from canonical.launchpad.webapp.authorization import check_permission221from canonical.launchpad.webapp.authorization import check_permission
222from canonical.launchpad.webapp.batching import BatchNavigator222from canonical.launchpad.webapp.batching import BatchNavigator
223from canonical.launchpad.webapp.breadcrumb import Breadcrumb223from canonical.launchpad.webapp.breadcrumb import Breadcrumb
224from canonical.launchpad.webapp.interfaces import IPlacelessLoginSource
225from canonical.launchpad.webapp.login import (224from canonical.launchpad.webapp.login import (
226 logoutPerson, allowUnauthenticatedSession)225 logoutPerson, allowUnauthenticatedSession)
227from canonical.launchpad.webapp.menu import get_current_view226from canonical.launchpad.webapp.menu import get_current_view
@@ -1404,7 +1403,6 @@
14041403
14051404
1406class DeactivateAccountSchema(Interface):1405class DeactivateAccountSchema(Interface):
1407 use_template(IPerson, include=['password'])
1408 comment = copy_field(1406 comment = copy_field(
1409 IPerson['account_status_comment'], readonly=False, __name__='comment')1407 IPerson['account_status_comment'], readonly=False, __name__='comment')
14101408
@@ -1415,19 +1413,6 @@
1415 label = "Deactivate your Launchpad account"1413 label = "Deactivate your Launchpad account"
1416 custom_widget('comment', TextAreaWidget, height=5, width=60)1414 custom_widget('comment', TextAreaWidget, height=5, width=60)
14171415
1418 def validate(self, data):
1419 loginsource = getUtility(IPlacelessLoginSource)
1420 principal = loginsource.getPrincipalByLogin(
1421 self.user.preferredemail.email)
1422 assert principal is not None, "User must be logged in at this point."
1423 # The widget will transform '' into a special marker value.
1424 password = data.get('password')
1425 if password is self.schema['password'].UNCHANGED_PASSWORD:
1426 password = u''
1427 if not principal.validate(password):
1428 self.setFieldError('password', 'Incorrect password.')
1429 return
1430
1431 @action(_("Deactivate My Account"), name="deactivate")1416 @action(_("Deactivate My Account"), name="deactivate")
1432 def deactivate_action(self, action, data):1417 def deactivate_action(self, action, data):
1433 self.context.deactivateAccount(data['comment'])1418 self.context.deactivateAccount(data['comment'])
14341419
=== modified file 'lib/lp/registry/stories/person/xx-deactivate-account.txt'
--- lib/lp/registry/stories/person/xx-deactivate-account.txt 2010-02-05 13:25:46 +0000
+++ lib/lp/registry/stories/person/xx-deactivate-account.txt 2010-03-16 13:03:31 +0000
@@ -1,7 +1,7 @@
1= Deactivating user accounts =1= Deactivating user accounts =
22
3Users who don't want to use Launchpad anymore can easily deactivate their3Users who don't want to use Launchpad anymore can easily deactivate their
4accounts, so they stop receiving emails from Launchpad and make it impossible4accounts so they stop receiving emails from Launchpad and make it impossible
5to use their accounts to log in.5to use their accounts to log in.
66
7Deactivating a user's account will un-assign all their bug tasks. To7Deactivating a user's account will un-assign all their bug tasks. To
@@ -35,25 +35,6 @@
35 >>> browser.url35 >>> browser.url
36 'http://launchpad.dev/~name12/+deactivate-account'36 'http://launchpad.dev/~name12/+deactivate-account'
3737
38To deactivate a user's account we require the user to enter his password.
39
40 >>> browser.getControl('Why are you deactivating your account?').value = (
41 ... "I'm going to become a Budhist monk in Tibet")
42 >>> browser.getControl('Deactivate My Account').click()
43 >>> for msg in get_feedback_messages(browser.contents):
44 ... print msg
45 There is 1 error.
46 Incorrect password.
47
48 >>> browser.getControl('Password').value = 't'
49 >>> browser.url
50 'http://launchpad.dev/%7Ename12/+deactivate-account'
51 >>> for msg in get_feedback_messages(browser.contents):
52 ... print msg
53 There is 1 error.
54 Incorrect password.
55
56 >>> browser.getControl('Password').value = 'test'
57 >>> browser.getControl('Deactivate My Account').click()38 >>> browser.getControl('Deactivate My Account').click()
58 >>> browser.url39 >>> browser.url
59 'http://launchpad.dev'40 'http://launchpad.dev'
6041
=== modified file 'lib/lp/registry/templates/person-deactivate-account.pt'
--- lib/lp/registry/templates/person-deactivate-account.pt 2009-09-15 17:30:28 +0000
+++ lib/lp/registry/templates/person-deactivate-account.pt 2010-03-16 13:03:31 +0000
@@ -9,11 +9,6 @@
99
10 <div metal:fill-slot="main">10 <div metal:fill-slot="main">
11 <div metal:use-macro="context/@@launchpad_form/form">11 <div metal:use-macro="context/@@launchpad_form/form">
12 <p metal:fill-slot="extra_top">
13 For verification purposes we ask that you enter your Launchpad
14 password. If you've forgotten it you'll have to
15 <a href="/+forgottenpassword">reset it</a> first.
16 </p>
1712
18 <div metal:fill-slot="extra_bottom">13 <div metal:fill-slot="extra_bottom">
19 <p>14 <p>