Skip to content

Commit

Permalink
Issue #1734: currentPassword is not needed for github users
Browse files Browse the repository at this point in the history
  • Loading branch information
bameda authored and jespino committed Jan 14, 2015
1 parent 64dde78 commit e81a73e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions taiga/users/api.py
Expand Up @@ -142,7 +142,10 @@ def change_password(self, request, pk=None):

current_password = request.DATA.get("current_password")
password = request.DATA.get("password")
if not current_password:

# NOTE: GitHub users have no password yet (request.user.passwor == '') so
# current_password can be None
if not current_password and request.user.password:
raise exc.WrongArguments(_("Current password parameter needed"))

if not password:
Expand All @@ -151,7 +154,7 @@ def change_password(self, request, pk=None):
if len(password) < 6:
raise exc.WrongArguments(_("Invalid password length at least 6 charaters needed"))

if not request.user.check_password(current_password):
if current_password and not request.user.check_password(current_password):
raise exc.WrongArguments(_("Invalid current password"))

request.user.set_password(password)
Expand Down

0 comments on commit e81a73e

Please sign in to comment.