From e81a73e24b65f1ee1478864cd2393aa313959cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Tue, 13 Jan 2015 14:25:01 +0100 Subject: [PATCH] Issue #1734: currentPassword is not needed for github users --- taiga/users/api.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/taiga/users/api.py b/taiga/users/api.py index 856f99a1..6407b8b9 100644 --- a/taiga/users/api.py +++ b/taiga/users/api.py @@ -142,7 +142,10 @@ class UsersViewSet(ModelCrudViewSet): 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: @@ -151,7 +154,7 @@ class UsersViewSet(ModelCrudViewSet): 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)