1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-21 07:46:38 +02:00
bitwarden-browser/src/popup/app/accounts/accountsHintController.js

30 lines
996 B
JavaScript
Raw Normal View History

2016-09-20 23:47:21 +02:00
angular
.module('bit.accounts')
.controller('accountsHintController', function ($scope, $state, apiService, toastr, $q) {
popupUtils.initListSectionItemListeners();
2016-09-20 23:53:52 +02:00
$('#email').focus();
2016-09-20 23:47:21 +02:00
$scope.submitPromise = null;
$scope.submit = function (model) {
var request = new PasswordHintRequest(model.email);
$scope.submitPromise = hintPromise(request);
$scope.submitPromise.then(function () {
toastr.success('We\'ve sent you an email with your master password hint.');
$state.go('login');
});
};
function hintPromise(request) {
return $q(function (resolve, reject) {
apiService.postPasswordHint(request,
function () {
resolve();
},
function (error) {
reject(error);
});
});
}
});