From 71c12ccde0bef916998e96be647df2153cd59283 Mon Sep 17 00:00:00 2001 From: Eduardo Robles Date: Tue, 16 Nov 2021 17:44:23 +0100 Subject: [PATCH] changing credential storage to store all the credentials without filtering, as required by new election chooser in voting booth, and redirecting to parent election (#169) * changing credential storage to store all the credentials without filtering, as required by new election chooser in voting booth, and redirecting to parent election * allowing to hide parent in children-election info widget * simplifying redirection to voting booth --- .../login-directive/login-directive.js | 19 ++++--------------- .../children-elections-directive.html | 2 +- .../children-elections-directive.js | 1 + dist/appCommon-vmaster.js | 17 ++++++++--------- 4 files changed, 14 insertions(+), 25 deletions(-) diff --git a/avRegistration/login-directive/login-directive.js b/avRegistration/login-directive/login-directive.js index 67aba366..5aef8985 100644 --- a/avRegistration/login-directive/login-directive.js +++ b/avRegistration/login-directive/login-directive.js @@ -316,18 +316,14 @@ angular.module('avRegistration') // assumes the authapi response has the same children var tokens = _ .chain(response.data['vote-children-info']) - .filter(function (child) { - return ( - child['num-successful-logins-allowed'] === 0 || - child['num-successful-logins'] < child['num-successful-logins-allowed'] - ) && !!child['vote-permission-token']; - }) .map(function (child, index) { return { electionId: child['auth-event-id'], - token: child['vote-permission-token'], + token: child['vote-permission-token'] || null, skipped: false, voted: false, + numSuccessfulLoginsAllowed: child['num-successful-logins-allowed'], + numSuccessfulLogins: child['num-successful-logins'], isFirst: index === 0 }; }) @@ -337,14 +333,7 @@ angular.module('avRegistration') JSON.stringify(tokens) ); - if (tokens.length > 0) { - $window.location.href = '/booth/' + tokens[0].electionId + '/vote'; - } else { - scope.error = $i18next( - 'avRegistration.invalidCredentials', - {support: ConfigService.contact.email} - ); - } + $window.location.href = '/booth/' + autheventid + '/vote'; } else { scope.error = $i18next( 'avRegistration.invalidCredentials', diff --git a/avUi/children-elections-directive/children-elections-directive.html b/avUi/children-elections-directive/children-elections-directive.html index 802fac7d..7fec9bc8 100644 --- a/avUi/children-elections-directive/children-elections-directive.html +++ b/avUi/children-elections-directive/children-elections-directive.html @@ -1,6 +1,6 @@

avRegistration.fillValidFormText
'), $templateCache.put("avRegistration/success.html", '

'), $templateCache.put("avUi/change-lang-directive/change-lang-directive.html", ''), - $templateCache.put("avUi/children-elections-directive/children-elections-directive.html", '
avAdmin.childrenElections.main

{{category.title}}

{{election.title}}
'), + $templateCache.put("avUi/children-elections-directive/children-elections-directive.html", '
avAdmin.childrenElections.main

{{category.title}}

{{election.title}}
'), $templateCache.put("avUi/documentation-directive/documentation-directive.html", '

'), $templateCache.put("avUi/foot-directive/foot-directive.html", '
'), $templateCache.put("avUi/simple-error-directive/simple-error-directive.html", '
'),