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:
Vitor Baptista
2016-11-01 20:26:31 +00:00
parent 2f090435a5
commit 72389b00c9
3 changed files with 16 additions and 2 deletions

View File

@@ -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;
});
};
};

View File

@@ -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">

View File

@@ -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):