Skip to content

Commit

Permalink
Added support for setting the page title
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachel Breeze authored and nul800sebastiaan committed Sep 5, 2019
1 parent 626c6ba commit ce0712e
Showing 1 changed file with 30 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
});

function UmbLoginController($scope, $location, currentUserResource, formHelper, mediaHelper, umbRequestHelper, Upload, localizationService, userService, externalLoginInfo, resetPasswordCodeInfo, $timeout, authResource, $q) {
function UmbLoginController($scope, $location, currentUserResource, formHelper, mediaHelper, umbRequestHelper, Upload, localizationService, userService, externalLoginInfo, resetPasswordCodeInfo, $timeout, authResource, $q, $route) {

const vm = this;

Expand Down Expand Up @@ -60,7 +60,6 @@
vm.loginSubmit = loginSubmit;
vm.requestPasswordResetSubmit = requestPasswordResetSubmit;
vm.setPasswordSubmit = setPasswordSubmit;

vm.labels = {};
localizationService.localizeMany([
vm.usernameIsEmail ? "general_email" : "general_username",
Expand All @@ -76,6 +75,8 @@

// Check if it is a new user
const inviteVal = $location.search().invite;

vm.baseTitle = $scope.$root.locationTitle;
//1 = enter password, 2 = password set, 3 = invalid token
if (inviteVal && (inviteVal === "1" || inviteVal === "2")) {

Expand Down Expand Up @@ -122,6 +123,7 @@
vm.showLogin();
}

SetTitle();
}

function togglePassword() {
Expand Down Expand Up @@ -173,19 +175,22 @@
vm.errorMsg = "";
resetInputValidation();
vm.view = "login";
SetTitle();
}

function showRequestPasswordReset() {
vm.errorMsg = "";
resetInputValidation();
vm.view = "request-password-reset";
vm.showEmailResetConfirmation = false;
SetTitle();
}

function showSetPassword() {
vm.errorMsg = "";
resetInputValidation();
vm.view = "set-password";
SetTitle();
}

function loginSubmit() {
Expand Down Expand Up @@ -413,6 +418,7 @@
}
vm.twoFactor.view = viewPath;
vm.view = "2fa-login";
SetTitle();
}

function resetInputValidation() {
Expand All @@ -433,7 +439,28 @@
}



function SetTitle() {
var title = null;
switch (vm.view.toLowerCase()) {
case "login":
title = "Login";
break;
case "password-reset-code-expired":
case "request-password-reset":
title = "Password Reset";
break;
case "set-password":
title = "Change Password";
break;
case "2fa-login":
title = "Two Factor Authentication";
break;
}

if (title != null) {
$scope.$root.locationTitle = title + " - " + vm.baseTitle;
}
}

}

Expand Down

0 comments on commit ce0712e

Please sign in to comment.