Skip to content

Commit

Permalink
(js) Switch on "remember username" when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
cgx committed Dec 14, 2016
1 parent ef96c21 commit 5591b9d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -13,6 +13,7 @@ Bug fixes
- [web] fixed Sieve folder encoding support (#3904)
- [web] fixed ordering of calendars when renaming or adding a calendar (#3931)
- [web] use the organizer's alarm by default when accepting IMIP messages (#3934)
- [web] switch on "Remember username" when cookie username is set
- [eas] properly skip folders we don't want to synchronize (#3943)

3.2.4 (2016-12-01)
Expand Down
16 changes: 10 additions & 6 deletions UI/WebServerResources/js/Main/Main.app.js
Expand Up @@ -9,11 +9,15 @@
/**
* @ngInject
*/
LoginController.$inject = ['$scope', '$timeout', 'Dialog', '$mdDialog', 'Authentication'];
function LoginController($scope, $timeout, Dialog, $mdDialog, Authentication) {
LoginController.$inject = ['$scope', '$window', '$timeout', 'Dialog', '$mdDialog', 'Authentication'];
function LoginController($scope, $window, $timeout, Dialog, $mdDialog, Authentication) {
var vm = this;

vm.creds = { username: cookieUsername, password: null };
vm.creds = {
username: $window.cookieUsername,
password: null,
rememberLogin: angular.isDefined($window.cookieUsername) && $window.cookieUsername.length > 0
};
vm.login = login;
vm.loginState = false;
vm.showAbout = showAbout;
Expand All @@ -31,10 +35,10 @@

// Let the user see the succesfull message before reloading the page
$timeout(function() {
if (window.location.href === data.url)
window.location.reload(true);
if ($window.location.href === data.url)
$window.location.reload(true);
else
window.location.href = data.url;
$window.location.href = data.url;
}, 1000);
}, function(msg) {
vm.loginState = 'error';
Expand Down

0 comments on commit 5591b9d

Please sign in to comment.