1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

sweet alert lib implemented. added confirmation to password generator edit

This commit is contained in:
Kyle Spearrin
2016-09-19 23:56:27 -04:00
parent 68337d6523
commit 81dd1ff0f2
6 changed files with 97 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
angular
.module('bit.vault')
.controller('vaultEditSiteController', function ($scope, $state, $stateParams, siteService, folderService, cryptoService, $q, toastr) {
.controller('vaultEditSiteController', function ($scope, $state, $stateParams, siteService, folderService, cryptoService, $q, toastr, SweetAlert) {
var returnScrollY = $stateParams.returnScrollY;
var returnSearchText = $stateParams.returnSearchText;
var siteId = $stateParams.siteId;
@@ -61,10 +61,29 @@ angular
};
$scope.generatePassword = function () {
var confirmed = true;
if ($scope.site.password) {
// TODO: confirmation
SweetAlert.swal({
title: 'Warning',
text: 'Are you sure you want to overwrite the current password?',
type: 'warning',
showCancelButton: true,
confirmButtonText: 'Yes',
cancelButtonText: 'No'
},
function (confirm) {
if (confirm) {
goPasswordGenerator();
}
});
}
else {
goPasswordGenerator();
}
};
function goPasswordGenerator() {
$state.go('passwordGenerator', {
animation: 'in-slide-up',
editState: {
@@ -75,5 +94,5 @@ angular
returnSearchText: returnSearchText
}
});
};
}
});