Update SFJS to include authentication locking, lock authentication UI after submit

This commit is contained in:
Mo Bitar
2018-10-13 14:43:25 -05:00
parent d226be41b7
commit 00dd21179f
4 changed files with 12 additions and 6 deletions

View File

@@ -66,6 +66,7 @@ class AccountMenu {
syncManager.lockSyncing();
$scope.formData.status = "Generating Login Keys...";
$scope.formData.authenticating = true;
$timeout(function(){
authManager.login($scope.formData.url, $scope.formData.email, $scope.formData.user_password,
$scope.formData.ephemeral, $scope.formData.strictSignin, extraParams).then((response) => {
@@ -88,6 +89,8 @@ class AccountMenu {
$scope.formData.mfa = null;
if(error.message) { alert(error.message); }
}
$scope.formData.authenticating = false;
}
// Success
else {
@@ -110,6 +113,7 @@ class AccountMenu {
$scope.formData.confirmPassword = false;
$scope.formData.status = "Generating Account Keys...";
$scope.formData.authenticating = true;
$timeout(function(){
authManager.register($scope.formData.url, $scope.formData.email, $scope.formData.user_password, $scope.formData.ephemeral).then((response) => {
@@ -117,6 +121,7 @@ class AccountMenu {
if(!response || response.error) {
$scope.formData.status = null;
var error = response ? response.error : {message: "An unknown error occured."}
$scope.formData.authenticating = false;
alert(error.message);
} else {
$scope.onAuthSuccess(() => {
@@ -139,6 +144,7 @@ class AccountMenu {
$scope.onAuthSuccess = function(callback) {
var block = function() {
$timeout(function(){
$scope.formData.authenticating = false;
$scope.onSuccessfulAuth()();
syncManager.refreshErroredItems();
callback && callback();

View File

@@ -45,7 +45,7 @@
%a{"href" => "https://standardnotes.org/help/security", "target" => "_blank"} (Learn more)
.button-group.stretch.panel-row.form-submit
%button.button.info.featured{"type" => "submit"}
%button.button.info.featured{"type" => "submit", "ng-disabled" => "formData.authenticating"}
.label {{formData.showLogin ? "Sign In" : "Register"}}
%label

8
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "standard-notes-web",
"version": "2.3.11",
"version": "2.3.13",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -8006,9 +8006,9 @@
"dev": true
},
"standard-file-js": {
"version": "0.3.16",
"resolved": "https://registry.npmjs.org/standard-file-js/-/standard-file-js-0.3.16.tgz",
"integrity": "sha512-xCyEABG6+JE09A6jZJW49QczNntAtYvN3DQXMPu1PiaiFFYinBXYMmMdGKAAgH+a2T2w0UzB6mrMCjCMuz+tYw==",
"version": "0.3.17",
"resolved": "https://registry.npmjs.org/standard-file-js/-/standard-file-js-0.3.17.tgz",
"integrity": "sha512-YeX33yz19TB+JrkCWigO21Tugw6oVRi2s8m0lHG0JSOPr4UNA7ufdbzcFgQyDbh6UvF6eCevb1uezt3A3nejmQ==",
"dev": true
},
"static-extend": {

View File

@@ -39,7 +39,7 @@
"karma-jasmine": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.2",
"sn-stylekit": "1.0.15",
"standard-file-js": "0.3.16",
"standard-file-js": "0.3.17",
"sn-models": "0.1.9",
"connect": "^3.6.6",
"mocha": "^5.2.0",