diff --git a/src/js/login.js b/src/js/login.js index f674a0b84..80cac2cda 100644 --- a/src/js/login.js +++ b/src/js/login.js @@ -21,15 +21,6 @@ app.controller('LoginController', ['$scope', '$http', function ($scope, $http) { $scope.newPasswordRepeat = ''; var API_ORIGIN = '<%= oauth.apiOrigin %>' || window.location.origin; - if (search.passwordReset) { - $scope.mode = 'passwordReset'; - } else if (search.resetToken) { - $scope.mode = 'newPassword'; - setTimeout(function () { $('#inputNewPassword').focus(); }, 200); - } else { - $scope.mode = 'login'; - } - $scope.onLogin = function () { $scope.busy = true; $scope.error = false; @@ -114,4 +105,15 @@ app.controller('LoginController', ['$scope', '$http', function ($scope, $http) { $scope.error = false; setTimeout(function () { $('#inputUsername').focus(); }, 200); }; + + $scope.showNewPassword = function () { + window.document.title = 'Set New Password'; + $scope.mode = 'newPassword'; + setTimeout(function () { $('#inputNewPassword').focus(); }, 200); + }; + + // Init into the correct view + if (search.passwordReset) $scope.showPasswordReset(); + else if (search.resetToken) $scope.showNewPassword(); + else $scope.showLogin(); }]);