mirror of
https://github.com/getredash/redash.git
synced 2025-12-25 01:03:20 -05:00
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.
This commit is contained in:
@@ -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;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
@@ -27,6 +27,16 @@
|
||||
<button class="btn btn-default" ng-click="sendPasswordReset()" ng-disabled="disablePasswordResetButton">Send
|
||||
Password Reset Email
|
||||
</button>
|
||||
|
||||
<div ng-if="passwordResetLink && !disablePasswordResetButton" class="alert alert-success">
|
||||
<p>
|
||||
<strong>The user should receive a link to reset his password by email soon.</strong>
|
||||
</p>
|
||||
<p ng-if="clientConfig.mailSettingsMissing">
|
||||
You can use the following link to reset the password yourself:<br/>
|
||||
{{passwordResetLink}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-show="selectedTab == 'apiKey'" class="p-10">
|
||||
|
||||
@@ -74,6 +74,10 @@ class UserResetPasswordResource(BaseResource):
|
||||
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):
|
||||
|
||||
Reference in New Issue
Block a user