Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Findeton committed Jul 9, 2024
1 parent 442c231 commit 7e126e3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
6 changes: 4 additions & 2 deletions avRegistration/login-directive/login-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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']))
Expand All @@ -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",
Expand Down
17 changes: 9 additions & 8 deletions dist/appCommon-v10.4.2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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),
Expand All @@ -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,
Expand All @@ -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;
Expand Down

0 comments on commit 7e126e3

Please sign in to comment.