Change password reset to have both link and email

This commit is contained in:
Johannes Zellner
2021-10-27 18:36:41 +02:00
parent 4ae90fc2da
commit 13d7381c62
4 changed files with 50 additions and 23 deletions

View File

@@ -1873,8 +1873,17 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
});
};
Client.prototype.sendPasswordReset = function (identifier, callback) {
post('/api/v1/cloudron/password_reset_request', { identifier }, null, function (error, data, status) {
Client.prototype.getPasswordResetLink = function (userId, callback) {
get('/api/v1/users/' + userId + '/password_reset_link', null, function (error, data, status) {
if (error) return callback(error);
if (status !== 200) return callback(new ClientError(status, data));
callback(null, data);
});
};
Client.prototype.sendPasswordResetEmail = function (userId, email, callback) {
post('/api/v1/users/' + userId + '/send_password_reset_email', { email }, null, function (error, data, status) {
if (error) return callback(error);
if (status !== 202) return callback(new ClientError(status, data));