Use profile based password reset from profile page
This commit is contained in:
@@ -1882,6 +1882,15 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Client.prototype.sendSelfPasswordReset = function (identifier, callback) {
|
||||||
|
post('/api/v1/cloudron/password_reset_request', { identifier }, null, function (error, data, status) {
|
||||||
|
if (error) return callback(error);
|
||||||
|
if (status !== 202) return callback(new ClientError(status, data));
|
||||||
|
|
||||||
|
callback(null, data);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
Client.prototype.getInviteLink = function (userId, callback) {
|
Client.prototype.getInviteLink = function (userId, callback) {
|
||||||
get('/api/v1/users/' + userId + '/invite_link', null, function (error, data, status) {
|
get('/api/v1/users/' + userId + '/invite_link', null, function (error, data, status) {
|
||||||
if (error) return callback(error);
|
if (error) return callback(error);
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ angular.module('Application').controller('ProfileController', ['$scope', '$trans
|
|||||||
});
|
});
|
||||||
|
|
||||||
$scope.sendPasswordReset = function () {
|
$scope.sendPasswordReset = function () {
|
||||||
Client.sendPasswordReset($scope.user.email, function (error) {
|
Client.sendSelfPasswordReset($scope.user.email, function (error) {
|
||||||
if (error) return console.error('Failed to reset password:', error);
|
if (error) return console.error('Failed to reset password:', error);
|
||||||
|
|
||||||
Client.notify($translate.instant('profile.passwordResetNotification.title'), $translate.instant('profile.passwordResetNotification.body', { email: $scope.user.fallbackEmail}), false, 'success');
|
Client.notify($translate.instant('profile.passwordResetNotification.title'), $translate.instant('profile.passwordResetNotification.body', { email: $scope.user.fallbackEmail || $scope.user.email }), false, 'success');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user