Remove security link after upgrade

This commit is contained in:
Mo Bitar
2018-06-02 10:02:50 -05:00
parent 53300ac1b6
commit a6fb9f900b
3 changed files with 10 additions and 23 deletions

View File

@@ -25,8 +25,8 @@ angular.module('app')
.controller('FooterCtrl', function ($rootScope, authManager, modelManager, $timeout, dbManager, .controller('FooterCtrl', function ($rootScope, authManager, modelManager, $timeout, dbManager,
syncManager, storageManager, passcodeManager, componentManager, singletonManager, nativeExtManager) { syncManager, storageManager, passcodeManager, componentManager, singletonManager, nativeExtManager) {
this.securityUpdateAvailable = authManager.securityUpdateAvailable; this.securityUpdateAvailable = authManager.checkForSecurityUpdate();
$rootScope.$on("security-update-available", () => { $rootScope.$on("security-update-status-changed", () => {
this.securityUpdateAvailable = authManager.securityUpdateAvailable; this.securityUpdateAvailable = authManager.securityUpdateAvailable;
}) })

View File

@@ -16,7 +16,7 @@ class AccountMenu {
$scope.formData = {mergeLocal: true, url: syncManager.serverURL, ephemeral: false}; $scope.formData = {mergeLocal: true, url: syncManager.serverURL, ephemeral: false};
$scope.user = authManager.user; $scope.user = authManager.user;
$scope.server = syncManager.serverURL; $scope.server = syncManager.serverURL;
$scope.securityUpdateAvailable = authManager.securityUpdateAvailable; $scope.securityUpdateAvailable = authManager.checkForSecurityUpdate();
$scope.close = function() { $scope.close = function() {
$timeout(() => { $timeout(() => {

View File

@@ -243,6 +243,9 @@ angular.module('app')
httpManager.postAbsolute(requestUrl, params, (response) => { httpManager.postAbsolute(requestUrl, params, (response) => {
this.handleAuthResponse(response, email, null, newAuthParams, newKeys); this.handleAuthResponse(response, email, null, newAuthParams, newKeys);
callback(response); callback(response);
// Allows security update status to be changed if neccessary
this.checkForSecurityUpdate();
}, (response) => { }, (response) => {
if(typeof response !== 'object') { if(typeof response !== 'object') {
response = {error: {message: "Something went wrong while changing your password. Your password was not changed. Please try again."}} response = {error: {message: "Something went wrong while changing your password. Your password was not changed. Please try again."}}
@@ -251,35 +254,19 @@ angular.module('app')
}) })
} }
this.updateAuthParams = function(authParams, callback) {
var requestUrl = storageManager.getItem("server") + "/auth/update";
var params = authParams;
httpManager.postAbsolute(requestUrl, params, (response) => {
storageManager.setItem("auth_params", JSON.stringify(authParams));
if(callback) {
callback(response);
}
}, function(response){
var error = response;
console.error("Update error:", response);
if(callback) {
callback({error: error});
}
})
}
this.checkForSecurityUpdate = function() { this.checkForSecurityUpdate = function() {
if(this.offline()) { if(this.offline()) {
return; return false;
} }
let latest = SFJS.version(); let latest = SFJS.version();
let updateAvailable = this.protocolVersion() !== latest; let updateAvailable = this.protocolVersion() !== latest;
if(updateAvailable !== this.securityUpdateAvailable) { if(updateAvailable !== this.securityUpdateAvailable) {
this.securityUpdateAvailable = updateAvailable; this.securityUpdateAvailable = updateAvailable;
$rootScope.$broadcast("security-update-available"); $rootScope.$broadcast("security-update-status-changed");
} }
return this.securityUpdateAvailable;
} }
this.presentPasswordWizard = function(type) { this.presentPasswordWizard = function(type) {