Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Allow administrators to remove last second factor of users #35

Merged

Conversation

JamesAlias
Copy link
Contributor

No description provided.

@JamesAlias JamesAlias linked an issue Aug 12, 2024 that may be closed by this pull request
@Benjamin-K
Copy link
Contributor

Very nice! But for readability i think it would be better to rewrite the conditions to sth. like:

// Check, if user is allowed to remove second factor first
if ($isAdministrator || ($isOwner && $this->secondFactorService->canOneSecondFactorBeDeletedForAccount($account))) {
    // User is admin ore more than one second factor exists.
    // Remove second factor and show flash message.
    return;
}

// Next, check if the user is the owner of the second factor
if ($isOwner) {
    // As it is the owner, the second factor to be remove must be the last one, so we can't remove it.
    // Show error flash message.
    return;
}

// All others (neither administrator nor owner) are redirected to index
$this->redirect('index');

@JamesAlias JamesAlias force-pushed the 30-allow-administrators-to-remove-last-otp-of-other-users branch from 0e0e1a9 to 72a1998 Compare September 25, 2024 07:38
@JamesAlias JamesAlias merged commit abaa3c4 into main Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow administrators to remove last OTP of other users
3 participants