From 7e126e34f64c410149f8e5932640a2faf78e1e09 Mon Sep 17 00:00:00 2001 From: Findeton Date: Tue, 9 Jul 2024 09:57:23 -0500 Subject: [PATCH] wip --- .../login-directive/login-directive.js | 6 ++++-- dist/appCommon-v10.4.2.js | 17 +++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/avRegistration/login-directive/login-directive.js b/avRegistration/login-directive/login-directive.js index 777057d2..15ce4ef5 100644 --- a/avRegistration/login-directive/login-directive.js +++ b/avRegistration/login-directive/login-directive.js @@ -35,6 +35,7 @@ angular.module('avRegistration') function link(scope, element, attrs) { scope.isCensusQuery = attrs.isCensusQuery; + scope.isQuery = "true" === $location.search()['query']; scope.withCode = attrs.withCode; scope.username = attrs.username; scope.isOtl = attrs.isOtl; @@ -690,6 +691,7 @@ angular.module('avRegistration') $cookies.put("auth" + postfix, response.data['auth-token'], options); $cookies.put("isAdmin" + postfix, scope.isAdmin, options); Authmethod.setAuth($cookies.get("auth" + postfix), scope.isAdmin, autheventid); + var votingScreenPath = scope.isQuery ? '/eligibility' : '/vote'; if (scope.isAdmin) { Authmethod.getUserInfo() @@ -729,7 +731,7 @@ angular.module('avRegistration') "show-pdf", !!response.data['show-pdf'] ); - $window.location.href = '/booth/' + autheventid + '/vote'; + $window.location.href = '/booth/' + autheventid + votingScreenPath; } // if it's an election with children elections then show access to them else if (angular.isDefined(response.data['vote-children-info'])) @@ -755,7 +757,7 @@ angular.module('avRegistration') JSON.stringify(tokens) ); - $window.location.href = '/booth/' + autheventid + '/vote'; + $window.location.href = '/booth/' + autheventid + votingScreenPath; } else { setError( "unrecognizedServerResponse", diff --git a/dist/appCommon-v10.4.2.js b/dist/appCommon-v10.4.2.js index 9352ff7b..5374cc07 100644 --- a/dist/appCommon-v10.4.2.js +++ b/dist/appCommon-v10.4.2.js @@ -413,10 +413,11 @@ angular.module("avRegistration").config(function() {}), angular.module("avRegist restrict: "AE", scope: !0, link: function(scope, element, attrs) { - scope.isCensusQuery = attrs.isCensusQuery, scope.withCode = attrs.withCode, scope.username = attrs.username, - scope.isOtl = attrs.isOtl, scope.isOpenId = attrs.isOpenId, scope.otlSecret = attrs.otlSecret, - scope.error = null, scope.errorData = null, scope.current_alt_auth_method_id = void 0, - scope.alternative_auth_methods = null, scope.csrf = null, attrs.withAltMethod && attrs.selectedAltMethod ? scope.selectedAltMethod = attrs.selectedAltMethod : scope.selectedAltMethod = null, + scope.isCensusQuery = attrs.isCensusQuery, scope.isQuery = "true" === $location.search().query, + scope.withCode = attrs.withCode, scope.username = attrs.username, scope.isOtl = attrs.isOtl, + scope.isOpenId = attrs.isOpenId, scope.otlSecret = attrs.otlSecret, scope.error = null, + scope.errorData = null, scope.current_alt_auth_method_id = void 0, scope.alternative_auth_methods = null, + scope.csrf = null, attrs.withAltMethod && attrs.selectedAltMethod ? scope.selectedAltMethod = attrs.selectedAltMethod : scope.selectedAltMethod = null, scope.hide_default_login_lookup_field = !1; var adminId = ConfigService.freeAuthId + "", autheventid = null; function simpleRedirectToLogin() { @@ -576,14 +577,14 @@ angular.module("avRegistration").config(function() {}), angular.module("avRegist scope.sendingData = !0, setError(null, null); var sessionStartedAtMs = Date.now(); Authmethod.login(data, autheventid).then(function(tokens) { - var postfix, options; + var postfix, options, votingScreenPath; "ok" === tokens.data.status ? (postfix = "_authevent_" + autheventid, options = {}, ConfigService.authTokenExpirationSeconds && (options.expires = new Date(Date.now() + 1e3 * ConfigService.authTokenExpirationSeconds)), $cookies.put("authevent_" + autheventid, autheventid, options), $cookies.put("userid" + postfix, tokens.data.username, options), $cookies.put("user" + postfix, scope.email || tokens.data.username || tokens.data.email, options), $cookies.put("auth" + postfix, tokens.data["auth-token"], options), $cookies.put("isAdmin" + postfix, scope.isAdmin, options), Authmethod.setAuth($cookies.get("auth" + postfix), scope.isAdmin, autheventid), - scope.isAdmin ? Authmethod.getUserInfo().then(function(response) { + votingScreenPath = scope.isQuery ? "/eligibility" : "/vote", scope.isAdmin ? Authmethod.getUserInfo().then(function(response) { var redirectUrl = $window.sessionStorage.getItem("redirect"); redirectUrl ? $window.sessionStorage.removeItem("redirect") : redirectUrl = "/admin/elections", $cookies.put("user" + postfix, response.data.email || scope.email || response.data.username, options), @@ -595,7 +596,7 @@ angular.module("avRegistration").config(function() {}), angular.module("avRegist token: tokens.data["vote-permission-token"], isFirst: !0, sessionStartedAtMs: sessionStartedAtMs - } ])), $window.sessionStorage.setItem("show-pdf", !!tokens.data["show-pdf"]), $window.location.href = "/booth/" + autheventid + "/vote") : angular.isDefined(tokens.data["vote-children-info"]) ? (tokens = _.chain(tokens.data["vote-children-info"]).map(function(child, index) { + } ])), $window.sessionStorage.setItem("show-pdf", !!tokens.data["show-pdf"]), $window.location.href = "/booth/" + autheventid + votingScreenPath) : angular.isDefined(tokens.data["vote-children-info"]) ? (tokens = _.chain(tokens.data["vote-children-info"]).map(function(child, index) { return { electionId: child["auth-event-id"], token: child["vote-permission-token"] || null, @@ -607,7 +608,7 @@ angular.module("avRegistration").config(function() {}), angular.module("avRegist sessionStartedAtMs: sessionStartedAtMs }; }).value(), $window.sessionStorage.setItem("vote_permission_tokens", JSON.stringify(tokens)), - $window.location.href = "/booth/" + autheventid + "/vote") : setError("unrecognizedServerResponse", "avRegistration.loginError." + scope.method + ".unrecognizedServerResponse")) : (scope.sendingData = !1, + $window.location.href = "/booth/" + autheventid + votingScreenPath) : setError("unrecognizedServerResponse", "avRegistration.loginError." + scope.method + ".unrecognizedServerResponse")) : (scope.sendingData = !1, setError("invalidServerResponse", "avRegistration.loginError." + scope.method + ".invalidServerResponse")); }, function(codename) { scope.sendingData = !1;