Skip to content

Commit eac4f27

Browse files
committed
add auth-method to sendAuthCodes
1 parent 61170bd commit eac4f27

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

avRegistration/auth-method-service.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,21 @@ angular.module('avRegistration')
243243
return $http.get(backendUrl + 'acl/mine/?object_type=AuthEvent&perm=edit&order=-pk&page='+page);
244244
};
245245

246-
authmethod.sendAuthCodes = function(eid, election, user_ids, extra) {
246+
authmethod.sendAuthCodes = function(eid, election, user_ids, auth_method, extra) {
247247
var url = backendUrl + 'auth-event/'+eid+'/census/send_auth/';
248248
var data = {};
249249
if (angular.isDefined(election)) {
250250
data.msg = election.census.config.msg;
251-
if (election.census.auth_method === 'email') {
251+
if (authmethod === 'email') {
252252
data.subject = election.census.config.subject;
253253
}
254254
}
255255
if (angular.isDefined(user_ids)) {
256256
data["user-ids"] = user_ids;
257257
}
258+
if (angular.isDefined(auth_method)) {
259+
data["auth-method"] = auth_method;
260+
}
258261
if (extra) {
259262
data["extra"] = extra;
260263
}

dist/appCommon-v3.0.1.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
137137
}, 500 * ConfigService.timeoutSeconds)), !1;
138138
}, authmethod.electionsIds = function(page) {
139139
return page || (page = 1), $http.get(backendUrl + "acl/mine/?object_type=AuthEvent&perm=edit&order=-pk&page=" + page);
140-
}, authmethod.sendAuthCodes = function(eid, election, user_ids, extra) {
140+
}, authmethod.sendAuthCodes = function(eid, election, user_ids, auth_method, extra) {
141141
var url = backendUrl + "auth-event/" + eid + "/census/send_auth/", data = {};
142-
return angular.isDefined(election) && (data.msg = election.census.config.msg, "email" === election.census.auth_method && (data.subject = election.census.config.subject)),
143-
angular.isDefined(user_ids) && (data["user-ids"] = user_ids), extra && (data.extra = extra),
144-
$http.post(url, data);
142+
return angular.isDefined(election) && (data.msg = election.census.config.msg, "email" === authmethod && (data.subject = election.census.config.subject)),
143+
angular.isDefined(user_ids) && (data["user-ids"] = user_ids), angular.isDefined(auth_method) && (data["auth-method"] = auth_method),
144+
extra && (data.extra = extra), $http.post(url, data);
145145
}, authmethod.removeUsersIds = function(eid, election, user_ids) {
146146
var url = backendUrl + "auth-event/" + eid + "/census/delete/", data = {
147147
"user-ids": user_ids
@@ -170,11 +170,11 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C
170170
} ]), angular.module("avRegistration").directive("avLogin", [ "Authmethod", "StateDataService", "$parse", "$state", "$cookies", "$i18next", "$window", "$timeout", "ConfigService", function(Authmethod, StateDataService, $parse, $state, $cookies, $i18next, $window, $timeout, ConfigService) {
171171
function link(scope, element, attrs) {
172172
var adminId = ConfigService.freeAuthId + "", autheventid = attrs.eventId;
173-
scope.orgName = ConfigService.organization.orgName, $cookies.authevent && $cookies.authevent === adminId && autheventid === adminId && (console.log("FELIX WINDOW HREF"),
174-
$window.location.href = "/admin/elections"), scope.sendingData = !1, scope.stateData = StateDataService.getData(),
175-
scope.code = null, attrs.code && attrs.code.length > 0 && (scope.code = attrs.code),
176-
scope.email = null, attrs.email && attrs.email.length > 0 && (scope.email = attrs.email),
177-
scope.isAdmin = !1, autheventid === adminId && (scope.isAdmin = !0), scope.resendAuthCode = function(field) {
173+
scope.orgName = ConfigService.organization.orgName, $cookies.authevent && $cookies.authevent === adminId && autheventid === adminId && ($window.location.href = "/admin/elections"),
174+
scope.sendingData = !1, scope.stateData = StateDataService.getData(), scope.code = null,
175+
attrs.code && attrs.code.length > 0 && (scope.code = attrs.code), scope.email = null,
176+
attrs.email && attrs.email.length > 0 && (scope.email = attrs.email), scope.isAdmin = !1,
177+
autheventid === adminId && (scope.isAdmin = !0), scope.resendAuthCode = function(field) {
178178
if (!scope.sendingData && "sms" === scope.method && scope.telIndex !== -1 && !scope.form["input" + scope.telIndex].$invalid) {
179179
field.value = "";
180180
var data = {};

0 commit comments

Comments
 (0)