diff --git a/src/js/client.js b/src/js/client.js index 1d24596f3..c1fee6060 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -1844,6 +1844,19 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout }); }; + Client.prototype.sendPasswordReset = function (callback) { + var data = { + identifier: this._userInfo.email + }; + + post('/api/v1/cloudron/password_reset_request', data, null, function (error, data, status) { + if (error) return callback(error); + if (status !== 202) return callback(new ClientError(status, data)); + + callback(null); + }); + }; + Client.prototype.setTwoFactorAuthenticationSecret = function (callback) { var data = {}; diff --git a/src/views/profile.html b/src/views/profile.html index 66bc77343..1845c6d98 100644 --- a/src/views/profile.html +++ b/src/views/profile.html @@ -361,6 +361,11 @@ {{ user.fallbackEmail }} + + + I forgot my password + +   {{ 'profile.language' | tr }} @@ -370,7 +375,7 @@ -
+
diff --git a/src/views/profile.js b/src/views/profile.js index 32ab81533..c6cde679c 100644 --- a/src/views/profile.js +++ b/src/views/profile.js @@ -17,6 +17,14 @@ angular.module('Application').controller('ProfileController', ['$scope', '$trans $translate.use(newVal.id); }); + $scope.sendPasswordReset = function () { + Client.sendPasswordReset(function (error) { + if (error) return console.error('Failed to reset password:', error); + + Client.notify('Password reset successful', 'Email sent to ' + $scope.user.fallbackEmail, false, 'success'); + }); + }; + $scope.twoFactorAuthentication = { busy: false, error: null,