1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-09-06 00:28:04 +02:00

alerts and redirects for settings

This commit is contained in:
Kyle Spearrin 2016-09-20 11:38:43 -04:00
parent 5fef6837b7
commit 5badea2d9d
6 changed files with 65 additions and 41 deletions

View File

@ -1,16 +1,60 @@
angular angular
.module('bit.settings') .module('bit.settings')
.controller('settingsController', function ($scope, loginService, $state, syncService) { .controller('settingsController', function ($scope, loginService, $state, syncService, SweetAlert) {
$scope.sync = function () { $scope.sync = function () {
syncService.fullSync(function () { syncService.fullSync(function () {
alert('Sync done!'); alert('Sync done!');
}); });
}; };
$scope.logOut = function (model) { $scope.logOut = function () {
loginService.logOut(function () { loginService.logOut(function () {
$state.go('login'); $state.go('login');
}); });
}; };
$scope.changePassword = function () {
SweetAlert.swal({
title: 'Change Master Password',
text: 'You can change your master password on the bitwarden.com web vault. Do you want to visit the website now?',
type: 'info',
showCancelButton: true,
confirmButtonText: 'Yes',
cancelButtonText: 'Cancel'
}, alertCallback);
};
$scope.changeEmail = function () {
SweetAlert.swal({
title: 'Change Email',
text: 'You can change your email address on the bitwarden.com web vault. Do you want to visit the website now?',
type: 'info',
showCancelButton: true,
confirmButtonText: 'Yes',
cancelButtonText: 'Cancel'
}, alertCallback);
};
$scope.twoStep = function () {
SweetAlert.swal({
title: 'Two-step Login',
text: 'Two-step login makes your account more secure by requiring you to enter a security code from an authenticator app whenever you log in. Two-step login can be enabled on the bitwarden.com web vault. Do you want to visit the website now?',
type: 'info',
showCancelButton: true,
confirmButtonText: 'Yes',
cancelButtonText: 'Cancel'
}, alertCallback);
};
function alertCallback(confirmed) {
if (confirmed) {
chrome.tabs.create({ url: 'https://vault.bitwarden.com' });
}
}
$scope.rate = function () {
// TODO: detect which extension store to send them to
chrome.tabs.create({ url: 'https://google.com' });
};
}); });

View File

@ -1,2 +1,2 @@
angular angular
.module('bit.settings', []); .module('bit.settings', ['oitozero.ngSweetAlert']);

View File

@ -3,36 +3,26 @@
</div> </div>
<div class="content content-tabs"> <div class="content content-tabs">
<div class="list"> <div class="list">
<div class="list-section">
<div class="list-section-header">
Security
</div>
<div class="list-section-items">
<a class="list-section-item" href="#">
Lock Options
</a>
<a class="list-section-item" href="#">
Unlock with PIN Code
</a>
<a class="list-section-item" href="#">
Two-step Login
<i class="fa fa-chevron-right fa-lg"></i>
</a>
</div>
</div>
<div class="list-section"> <div class="list-section">
<div class="list-section-header"> <div class="list-section-header">
Account Account
</div> </div>
<div class="list-section-items"> <div class="list-section-items">
<a class="list-section-item" href="#"> <a class="list-section-item" href="" ng-click="changePassword()">
Change Master Password Change Master Password
<i class="fa fa-chevron-right fa-lg"></i> <i class="fa fa-chevron-right fa-lg"></i>
</a> </a>
<a class="list-section-item" href="#"> <a class="list-section-item" href="" ng-click="changeEmail()">
Change Email Change Email
<i class="fa fa-chevron-right fa-lg"></i> <i class="fa fa-chevron-right fa-lg"></i>
</a> </a>
<a class="list-section-item" href="" ng-click="twoStep()">
Two-step Login
<i class="fa fa-chevron-right fa-lg"></i>
</a>
<a class="list-section-item" href="" ng-click="logOut()">
Log out
</a>
</div> </div>
</div> </div>
<div class="list-section"> <div class="list-section">
@ -50,19 +40,6 @@
</a> </a>
</div> </div>
</div> </div>
<div class="list-section">
<div class="list-section-header">
Current Session
</div>
<div class="list-section-items">
<a class="list-section-item" href="">
Lock
</a>
<a class="list-section-item" href="" ng-click="logOut()">
Log out
</a>
</div>
</div>
<div class="list-section"> <div class="list-section">
<div class="list-section-header"> <div class="list-section-header">
Other Other
@ -76,7 +53,7 @@
Help &amp; Feedback Help &amp; Feedback
<i class="fa fa-chevron-right fa-lg"></i> <i class="fa fa-chevron-right fa-lg"></i>
</a> </a>
<a class="list-section-item" href="#"> <a class="list-section-item" href="" ng-click="rate()">
Rate the Extension Rate the Extension
<i class="fa fa-chevron-right fa-lg"></i> <i class="fa fa-chevron-right fa-lg"></i>
</a> </a>

View File

@ -22,8 +22,8 @@
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'Yes', confirmButtonText: 'Yes',
cancelButtonText: 'Cancel' cancelButtonText: 'Cancel'
}, function (confirm) { }, function (confirmed) {
if (confirm) { if (confirmed) {
chrome.tabs.create({ url: 'https://vault.bitwarden.com' }); chrome.tabs.create({ url: 'https://vault.bitwarden.com' });
} }
}); });

View File

@ -61,7 +61,6 @@ angular
}; };
$scope.generatePassword = function () { $scope.generatePassword = function () {
var confirmed = true;
if ($scope.site.password) { if ($scope.site.password) {
SweetAlert.swal({ SweetAlert.swal({
title: 'Warning', title: 'Warning',
@ -70,8 +69,8 @@ angular
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'Yes', confirmButtonText: 'Yes',
cancelButtonText: 'No' cancelButtonText: 'No'
}, function (confirm) { }, function (confirmed) {
if (confirm) { if (confirmed) {
goPasswordGenerator(); goPasswordGenerator();
} }
}); });

View File

@ -84,6 +84,10 @@
/* Sweet alert */ /* Sweet alert */
.sweet-alert { .sweet-alert {
border-radius: 0;
-webkit-border-radius: 0;
-moz-border-radius: 0;
p { p {
color: @text-color; color: @text-color;
font-weight: normal; font-weight: normal;