Skip to content

Commit

Permalink
Merge pull request #5 from CodiTramuntana/refactor_and_doc
Browse files Browse the repository at this point in the history
Refactor and add Warning section
  • Loading branch information
tramuntanal authored Jan 29, 2021
2 parents 60741f3 + f5c6745 commit c490c5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ Once enabled, non registered (thus not logged in) participants will have to navi

Note that although the only way for participants to open a session is by clicking the "Support" button, once verified, she will be able to perform all the actions that require the authentications she has verified for.

### Run tests
### Warning

Platform administrators should take care not to reset authorizations while in the middle of a process.
Reseting verifications will remove `Authorization`s from existing impersonated users. This will allow participants to vote again in the same process with the same credentials via this module or being "manually" impersonated.

## Run tests

Create a dummy app in your application (if not present):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def call
# we can not reuse existing authorization because it will raise "A participant is already authorized with the same data." on @form.valid?
# as it is an impersonated user, we can safely destroy it and perform the verification process again
transaction do
@user = @authorization.user
user.skip_confirmation!
destroy_authorization
if @form.valid?
authorize_user
Expand Down Expand Up @@ -60,13 +62,8 @@ def existing_registered_user?
@user = @authorization.user unless @authorization.user.managed?
end

# Searches for an authentication user associated to the given form authorizations
# The user should BE managed.
def existing_impersonated_user?
if @authorization.user.managed?
@user = @authorization.user
user.skip_confirmation!
end
@authorization.user.managed?
end

# Some authentication already exists?
Expand Down

0 comments on commit c490c5f

Please sign in to comment.