From 72389b00c954f85ab10a552f7affc24c12c17a6a Mon Sep 17 00:00:00 2001 From: Vitor Baptista Date: Tue, 1 Nov 2016 20:26:31 +0000 Subject: [PATCH 1/4] Display user's password reset link to the admin Similarly to when we invite new users, this allows the admin to reset the password herself (or send it manually to the user), in cases where there's some issue sending the e-mail. --- rd_ui/app/scripts/controllers/users.js | 4 ++-- rd_ui/app/views/users/show.html | 10 ++++++++++ redash/handlers/users.py | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/rd_ui/app/scripts/controllers/users.js b/rd_ui/app/scripts/controllers/users.js index 6e0869c5b3..0e76509027 100644 --- a/rd_ui/app/scripts/controllers/users.js +++ b/rd_ui/app/scripts/controllers/users.js @@ -302,9 +302,9 @@ $scope.sendPasswordReset = function() { $scope.disablePasswordResetButton = true; - $http.post('api/users/' + $scope.user.id + '/reset_password').success(function(user) { + $http.post('api/users/' + $scope.user.id + '/reset_password').success(function(data) { $scope.disablePasswordResetButton = false; - growl.addSuccessMessage("The user should receive a link to reset his password by email soon.") + $scope.passwordResetLink = data.reset_link; }); }; }; diff --git a/rd_ui/app/views/users/show.html b/rd_ui/app/views/users/show.html index f64d2eab18..8bbdd7e02a 100644 --- a/rd_ui/app/views/users/show.html +++ b/rd_ui/app/views/users/show.html @@ -27,6 +27,16 @@

{{user.name}}

+ +
+

+ The user should receive a link to reset his password by email soon. +

+

+ You can use the following link to reset the password yourself:
+ {{passwordResetLink}} +

+
diff --git a/redash/handlers/users.py b/redash/handlers/users.py index 1bbc7f04a6..4bb977b8eb 100644 --- a/redash/handlers/users.py +++ b/redash/handlers/users.py @@ -74,6 +74,10 @@ def post(self, user_id): user = models.User.get_by_id_and_org(user_id, self.current_org) reset_link = send_password_reset_email(user) + return { + 'reset_link': reset_link, + } + class UserResource(BaseResource): def get(self, user_id): From 69c1f15ce97a580dbbaea69d052df55429e1ddb1 Mon Sep 17 00:00:00 2001 From: Vitor Baptista Date: Wed, 2 Nov 2016 18:22:13 +0000 Subject: [PATCH 2/4] Wrap "Password Reset Button" in form group to visually separate it --- rd_ui/app/views/users/show.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rd_ui/app/views/users/show.html b/rd_ui/app/views/users/show.html index 8bbdd7e02a..82768c0755 100644 --- a/rd_ui/app/views/users/show.html +++ b/rd_ui/app/views/users/show.html @@ -24,9 +24,11 @@

{{user.name}}


- +
+ +

From 438ebb940eec761ed5c3dd21687040f852e61130 Mon Sep 17 00:00:00 2001 From: Vitor Baptista Date: Mon, 7 Nov 2016 18:13:33 +0000 Subject: [PATCH 3/4] Fix condition to show forgotten password link and alter its message --- rd_ui/app/views/users/show.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rd_ui/app/views/users/show.html b/rd_ui/app/views/users/show.html index 82768c0755..07d7ce65e0 100644 --- a/rd_ui/app/views/users/show.html +++ b/rd_ui/app/views/users/show.html @@ -34,9 +34,10 @@

{{user.name}}

The user should receive a link to reset his password by email soon.

-

- You can use the following link to reset the password yourself:
- {{passwordResetLink}} +

+ You don't have mail server configured, please send the following link + to {{user.name}} to reset their password:
+ {{passwordResetLink}}

From 3ca78bebdec44f1b8f0f27154ee3a321c9213a0b Mon Sep 17 00:00:00 2001 From: Vitor Baptista Date: Wed, 16 Nov 2016 17:38:17 +0000 Subject: [PATCH 4/4] Fix conditions to show the user reset link --- rd_ui/app/views/users/show.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rd_ui/app/views/users/show.html b/rd_ui/app/views/users/show.html index 07d7ce65e0..c3858860b3 100644 --- a/rd_ui/app/views/users/show.html +++ b/rd_ui/app/views/users/show.html @@ -30,11 +30,11 @@

{{user.name}}

-
-

+

+

The user should receive a link to reset his password by email soon.

-

+

You don't have mail server configured, please send the following link to {{user.name}} to reset their password:
{{passwordResetLink}}