diff --git a/gulpfile.js b/gulpfile.js
index 26c3e058fff..d5b778aa7e6 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -104,6 +104,10 @@ gulp.task('lib', ['clean:lib'], function () {
{
src: paths.npmDir + 'q/q.js',
dest: paths.libDir + 'q'
+ },
+ {
+ src: [paths.npmDir + 'sweetalert/dist/sweetalert.css', paths.npmDir + 'sweetalert/dist/sweetalert.min.js', paths.npmDir + 'angular-sweetalert/SweetAlert.js'],
+ dest: paths.libDir + 'sweetalert'
}
];
diff --git a/package.json b/package.json
index afe2aacf000..18119ce1766 100644
--- a/package.json
+++ b/package.json
@@ -25,6 +25,8 @@
"merge-stream": "1.0.0",
"angular-toastr": "2.1.1",
"q": "1.4.1",
- "angularjs-slider": "5.5.0"
+ "angularjs-slider": "5.5.0",
+ "sweetalert": "1.1.3",
+ "angular-sweetalert": "1.1.1"
}
}
diff --git a/src/popup/app/vault/vaultEditSiteController.js b/src/popup/app/vault/vaultEditSiteController.js
index 1ef0466e64d..1e32b335745 100644
--- a/src/popup/app/vault/vaultEditSiteController.js
+++ b/src/popup/app/vault/vaultEditSiteController.js
@@ -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
}
});
- };
+ }
});
diff --git a/src/popup/app/vault/vaultModule.js b/src/popup/app/vault/vaultModule.js
index 994b406671b..1021379f38c 100644
--- a/src/popup/app/vault/vaultModule.js
+++ b/src/popup/app/vault/vaultModule.js
@@ -1,2 +1,2 @@
angular
- .module('bit.vault', ['ngAnimate', 'toastr', 'ngclipboard']);
+ .module('bit.vault', ['ngAnimate', 'toastr', 'ngclipboard', 'oitozero.ngSweetAlert']);
diff --git a/src/popup/index.html b/src/popup/index.html
index 6af7a0b2710..d136435e500 100644
--- a/src/popup/index.html
+++ b/src/popup/index.html
@@ -8,6 +8,7 @@
+
@@ -22,6 +23,8 @@
+
+
diff --git a/src/popup/less/plugins.less b/src/popup/less/plugins.less
index 3bc76c0ba17..4bf2b472077 100644
--- a/src/popup/less/plugins.less
+++ b/src/popup/less/plugins.less
@@ -35,6 +35,7 @@
&.toast-danger, &.toast-error {
background-image: none !important;
background-color: @brand-danger;
+
&:before {
content: "\f0e7";
}
@@ -43,6 +44,7 @@
&.toast-warning {
background-image: none !important;
background-color: @brand-warning;
+
&:before {
content: "\f071";
}
@@ -51,6 +53,7 @@
&.toast-info {
background-image: none !important;
background-color: @brand-info;
+
&:before {
content: "\f005";
}
@@ -59,6 +62,7 @@
&.toast-success {
background-image: none !important;
background-color: @brand-success;
+
&:before {
content: "\f00C";
}
@@ -76,3 +80,63 @@
}
}
}
+
+/* Sweet alert */
+
+.sweet-alert {
+ p {
+ color: @text-color;
+ font-weight: normal;
+ }
+
+ h2 {
+ line-height: 30px;
+ font-size: 25px;
+ }
+
+ .sa-icon.sa-error {
+ border-color: @brand-danger;
+ }
+
+ .pulseErrorIns {
+ background-color: @brand-danger !important;
+ }
+
+ .sa-icon.sa-info {
+ border-color: @brand-info;
+ }
+
+ .pulseInfoIns {
+ background-color: @brand-info !important;
+ }
+
+ .sa-icon.sa-success {
+ border-color: @brand-success;
+ }
+
+ .pulseSuccessIns {
+ background-color: @brand-success !important;
+ }
+
+ .sa-icon.sa-warning {
+ border-color: @brand-warning;
+ }
+
+ .pulseWarningIns {
+ background-color: @brand-warning !important;
+ }
+
+ button {
+ border-radius: 0;
+ -webkit-border-radius: 0;
+ -moz-border-radius: 0;
+
+ &.confirm, &.confirm:hover {
+ background-color: @brand-primary !important;
+ }
+
+ &.cancel, &.cancel:hover {
+ background-color: @gray-light;
+ }
+ }
+}