Updates to password wizard

This commit is contained in:
Mo Bitar
2018-05-24 11:27:14 -05:00
parent f9d5323336
commit 0dbeff78a6
11 changed files with 86 additions and 43 deletions

View File

@@ -25,6 +25,11 @@ angular.module('app')
.controller('FooterCtrl', function ($rootScope, authManager, modelManager, $timeout, dbManager,
syncManager, storageManager, passcodeManager, componentManager, singletonManager, nativeExtManager) {
this.securityUpdateAvailable = authManager.securityUpdateAvailable;
this.openSecurityUpdate = function() {
authManager.presentPasswordWizard("upgrade-security");
}
$rootScope.$on("reload-ext-data", () => {
if(this.reloadInProgress) { return; }
this.reloadInProgress = true;

View File

@@ -16,6 +16,7 @@ class AccountMenu {
$scope.formData = {mergeLocal: true, url: syncManager.serverURL, ephemeral: false};
$scope.user = authManager.user;
$scope.server = syncManager.serverURL;
$scope.securityUpdateAvailable = authManager.securityUpdateAvailable;
$scope.close = function() {
$timeout(() => {
@@ -152,10 +153,10 @@ class AccountMenu {
}
$scope.openPasswordWizard = function(type) {
var scope = $rootScope.$new(true);
scope.type = type;
var el = $compile( "<password-wizard type='type'></password-wizard>" )(scope);
angular.element(document.body).append(el);
// Close the account menu
$scope.close();
authManager.presentPasswordWizard(type);
}
// Allows indexeddb unencrypted logs to be deleted

View File

@@ -122,14 +122,14 @@ class PasswordWizard {
$scope.resyncData((syncSuccess) => {
$scope.formData.statusError = !syncSuccess;
$scope.formData.processing = syncSuccess;
$scope.formData.processing = !syncSuccess;
if(syncSuccess) {
$scope.lockContinue = false;
if($scope.changePassword) {
$scope.formData.status = "Successfully changed password and re-encrypted all items. Press Continue to proceed.";
$scope.formData.status = "Successfully changed password and synced all items.";
} else if($scope.securityUpdate) {
$scope.formData.status = "Successfully performed security update and re-encrypted all items. Press Continue to proceed.";
$scope.formData.status = "Successfully performed security update and synced all items.";
}
} else {
$scope.formData.status = FailedSyncMessage;
@@ -203,9 +203,9 @@ class PasswordWizard {
let currentServerPw = this.currentServerPw;
SFJS.crypto.generateInitialKeysAndAuthParamsForUser(authManager.user.email, newUserPassword).then((results) => {
let newKeys = results.newKeys;
let newAuthParams = results.newAuthParams;
let newKeys = results.keys;
let newAuthParams = results.authParams;
// perform a sync beforehand to pull in any last minutes changes before we change the encryption key (and thus cant decrypt new changes)
syncManager.sync((response) => {
authManager.changePassword(currentServerPw, newKeys, newAuthParams, (response) => {

View File

@@ -7,11 +7,11 @@ angular.module('app')
return domain;
}
this.$get = function($rootScope, $timeout, httpManager, modelManager, dbManager, storageManager, singletonManager) {
return new AuthManager($rootScope, $timeout, httpManager, modelManager, dbManager, storageManager, singletonManager);
this.$get = function($rootScope, $timeout, httpManager, modelManager, dbManager, storageManager, singletonManager, $compile) {
return new AuthManager($rootScope, $timeout, httpManager, modelManager, dbManager, storageManager, singletonManager, $compile);
}
function AuthManager($rootScope, $timeout, httpManager, modelManager, dbManager, storageManager, singletonManager) {
function AuthManager($rootScope, $timeout, httpManager, modelManager, dbManager, storageManager, singletonManager, $compile) {
this.loadInitialData = function() {
var userData = storageManager.getItem("user");
@@ -238,7 +238,7 @@ angular.module('app')
let newServerPw = newKeys.pw;
var requestUrl = storageManager.getItem("server") + "/auth/change_pw";
var params = _.merge({new_password: newServerPw}, newAuthParams);
var params = _.merge({new_password: newServerPw, current_password: current_server_pw}, newAuthParams);
httpManager.postAbsolute(requestUrl, params, (response) => {
this.handleAuthResponse(response, email, null, newAuthParams, newKeys);
@@ -275,10 +275,14 @@ angular.module('app')
}
let latest = SFJS.version();
this.securityUpdateAvailable = this.protocolVersion() !== latest;
}
if(this.protocolVersion() !== latest) {
// Prompt user to perform security update
}
this.presentPasswordWizard = function(type) {
var scope = $rootScope.$new(true);
scope.type = type;
var el = $compile( "<password-wizard type='type'></password-wizard>" )(scope);
angular.element(document.body).append(el);
}
this.staticifyObject = function(object) {

View File

@@ -12,6 +12,10 @@
}
}
#password-wizard {
font-size: 16px;
}
.panel {
background-color: white;
}
@@ -44,6 +48,12 @@
}
}
&.auto-height {
> .content {
height: auto !important;
}
}
&.medium {
> .content {
width: 700px;

View File

@@ -74,6 +74,10 @@ $screen-md-max: ($screen-lg-min - 1) !default;
margin-right: 5px !important;
}
.mr-8 {
margin-right: 8px !important;
}
.faded {
opacity: 0.5;
}

View File

@@ -83,6 +83,9 @@
.panel-row
%a.panel-row.condensed{"ng-click" => "openPasswordWizard('change-pw')"} Change Password
%a.panel-row.justify-left.condensed.success{"ng-if" => "securityUpdateAvailable", "ng-click" => "openPasswordWizard('upgrade-security')"}
.inline.circle.small.success.mr-8
.inline Security Update Available
.panel-section
%h3.title.panel-row Encryption

View File

@@ -1,4 +1,4 @@
.modal.small
#password-wizard.modal.small.auto-height
.content
.sn-component
.panel
@@ -9,16 +9,24 @@
%div{"ng-if" => "step == 0"}
%div{"ng-if" => "changePassword"}
%h3.title.panel-row Change your password
%p Because your encryption key is based on your password, changing your password requires all your data to be re-encrypted using your new key.
%h2.title.panel-row Change your password
%p Because your encryption key is based on your password, changing your password requires your data to be re-encrypted using your new key.
%p This process will guide you through changing your password.
%p If you have many items, re-uploading your data can take several minutes. You must keep the application window open during this process.
%div{"ng-if" => "securityUpdate"}
%h3.title.panel-row Perform security update
%p Welcome to the security update process.
%h2.title.panel-row Perform security update
%p
A new update is available for your account. Updates address improvements and enhancements to our security specification.
This process will guide you through the update, and perform the steps necessary with your supervision.
%p
For more information about security updates, please visit
%a{"href" => "https://standardnotes.org/help/security", "target" => "_blank"} standardnotes.org/help/security.
%p.panel-row
.info Press Continue to proceed.
.panel-row
%strong.info Press Continue to proceed.
.panel-row
.panel-section{"ng-if" => "step > 0"}
@@ -26,9 +34,10 @@
%div{"ng-if" => "step == 1"}
%p.panel-row
The entirety of your data will be re-encrypted and re-uploaded to your account. This is a generally safe process,
As a result of this process, the entirety of your data will be re-encrypted and re-uploaded to your account. This is a generally safe process,
but unforeseen factors like poor network connectivity or a sudden shutdown of your computer may cause this process to fail.
It's best to be on the safe side before large operations like this.
.panel-row
.panel-row
.button-group
.button.info{"ng-click" => "downloadBackup(true)"}
@@ -41,7 +50,11 @@
As a result of this process, your encryption keys will change.
Any devices on which you use Standard Notes will need to end their session. After this process completes, you'll be asked to sign back in.
%p.bold.panel-row Please sign out of all applications (excluding this one), including desktop, web, and mobile (iOS and Android).
%p.bold.panel-row.info-i Please sign out of all applications (excluding this one), including:
%ul
%li Desktop
%li Web (Chrome, Firefox, Safari)
%li Mobile (iOS and Android)
%p.panel-row Press Continue only when you have completed signing out of all your devices.
@@ -49,13 +62,14 @@
%div{"ng-if" => "changePassword"}
%div{"ng-if" => "securityUpdate"}
%p.panel-row Enter your current password. We'll run this through our encryption scheme to generate strong new encryption keys.
.panel-row
%form
%input.form-control{:type => 'password', "ng-model" => "formData.currentPassword", "placeholder" => "Current Password", "sn-autofocus" => "true", "should-focus" => "true"}
.panel-row
.panel-column.stretch
%form
%input.form-control{:type => 'password', "ng-model" => "formData.currentPassword", "placeholder" => "Current Password", "sn-autofocus" => "true", "should-focus" => "true"}
%input.form-control{"ng-if" => "changePassword", :type => 'password', "ng-model" => "formData.newPassword", "placeholder" => "New Password"}
%input.form-control{"ng-if" => "changePassword", :type => 'password', "ng-model" => "formData.newPasswordConfirmation", "placeholder" => "Confirm New Password"}
%input.form-control{"ng-if" => "changePassword", :type => 'password', "ng-model" => "formData.newPassword", "placeholder" => "New Password"}
%input.form-control{"ng-if" => "changePassword", :type => 'password', "ng-model" => "formData.newPasswordConfirmation", "placeholder" => "Confirm New Password"}
%div{"ng-if" => "step == 4"}
%p.panel-row
@@ -65,18 +79,21 @@
%p.panel-row
.spinner.small.inline.info.mr-5{"ng-if" => "formData.processing"}
.inline.bold{"ng-class" => "{'info' : !formData.statusError, 'error' : formData.statusError}"}
.inline.bold{"ng-class" => "{'info' : !formData.statusError, 'error' : formData.statusError}"}
{{formData.status}}
%div{"ng-if" => "step == 5"}
%div{"ng-if" => "changePassword"}
%p.panel-row Your password has been successfully changed.
%div{"ng-if" => "securityUpdate"}
%p.panel-row The security update has been successfully applied to your account.
%p.panel-row
The security update has been successfully applied to your account.
Please ensure you are running the latest version of Standard Notes on all platforms to ensure maximum compatibility.
%p.panel-row You may now sign back in to all your devices and close this window.
%p.panel-row You may now sign back in on all your devices and close this window.
.footer
.empty
%a.right{"ng-click" => "continue()", "ng-class" => "{'disabled' : lockContinue}"}
.spinner.small.inline.info.mr-5{"ng-if" => "showSpinner"}
{{continueTitle}}

View File

@@ -22,7 +22,10 @@
.right
.item{"ng-if" => "ctrl.newUpdateAvailable", "ng-click" => "ctrl.clickedNewUpdateAnnouncement()"}
.item{"ng-if" => "ctrl.securityUpdateAvailable == true", "ng-click" => "ctrl.openSecurityUpdate()"}
%span.success.label Security update available.
.item{"ng-if" => "ctrl.newUpdateAvailable == true", "ng-click" => "ctrl.clickedNewUpdateAnnouncement()"}
%span.info.label New update available.
.item.no-pointer{"ng-if" => "ctrl.lastSyncDate && !ctrl.isRefreshing"}

12
package-lock.json generated
View File

@@ -12371,9 +12371,9 @@
"dev": true
},
"sn-stylekit": {
"version": "1.0.14",
"resolved": "https://registry.npmjs.org/sn-stylekit/-/sn-stylekit-1.0.14.tgz",
"integrity": "sha512-0jx2hJOw8Qer/aqcyXSses5g1m+nNDtDkwFkonolyVheTyhJXZrCw4kIIV9tbeOspwqsVjR12pk7L+R2mnl61Q==",
"version": "1.0.15",
"resolved": "https://registry.npmjs.org/sn-stylekit/-/sn-stylekit-1.0.15.tgz",
"integrity": "sha512-QeWlaCMHtF/VhFWWICzmx39ger92DEj1uLiCW4VVLX9LtU7nKQ5plqHgrpvnctO+wNh9LIYdPBLLWxTwgXm6Eg==",
"dev": true
},
"spdx-exceptions": {
@@ -12385,9 +12385,6 @@
"standard-file-js": {
"version": "file:../../sf/sfjs",
"dev": true,
"requires": {
"regenerator-runtime": "0.11.1"
},
"dependencies": {
"babel-preset-es2016": {
"version": "6.24.1",
@@ -12395,8 +12392,7 @@
},
"regenerator-runtime": {
"version": "0.11.1",
"bundled": true,
"dev": true
"bundled": true
}
}
},

View File

@@ -36,7 +36,7 @@
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.2",
"sn-stylekit": "1.0.14",
"sn-stylekit": "1.0.15",
"standard-file-js": "file:~/Desktop/sf/sfjs"
},
"license": "GPL-3.0"