Skip to content

Commit

Permalink
🐞 public page is active (#208) (#209)
Browse files Browse the repository at this point in the history
Parent issue: sequentech/meta#213
  • Loading branch information
Findeton committed Aug 31, 2023
1 parent b3f6bc9 commit bc59713
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions avElection/public-controller/public-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,31 @@ angular
return;
}

//
if (
($state.current.name.startsWith("election.public.show.home") ||
$state.current.name.startsWith("election.public.show.login")) &&
presentation &&
presentation.extra_options &&
presentation.extra_options.disable__public_home &&
"smart-link" === $scope.auth_method
) {
window.location.href = ConfigService.defaultRoute;

return;
}

// if we are showing the election home but it is disable, redirect to
// login
if (
$state.current.name === "election.public.show.home" &&
$state.current.name.startsWith("election.public.show.home") &&
presentation &&
presentation.extra_options &&
presentation.extra_options.disable__public_home
presentation.extra_options.disable__public_home &&
"smart-link" !== $scope.auth_method
) {
$window.location.href = '/election/' + $stateParams.id + '/public/login';

return;
}

Expand Down Expand Up @@ -160,14 +176,15 @@ angular
$scope.election.extra_data = extra_data;
$scope.layout = "default";
$scope.electionState = value.data.payload.state;
$scope.autoReloadReceive(value);

$http
.get(ConfigService.authAPI + "auth-event/" + $stateParams.id + "/")
.then(
function(authEventResponse)
{
$scope.election.children_election_info = authEventResponse.data.events.children_election_info;
$scope.auth_method = authEventResponse.data.events.auth_method;
$scope.autoReloadReceive(value);
}
);
}
Expand Down

0 comments on commit bc59713

Please sign in to comment.