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

Allow to forbid login for a specific user #941

Open
marien-probesys opened this issue Jan 28, 2025 · 0 comments
Open

Allow to forbid login for a specific user #941

marien-probesys opened this issue Jan 28, 2025 · 0 comments
Assignees
Labels
ready ✅ You can work on this!
Milestone

Comments

@marien-probesys
Copy link
Member

marien-probesys commented Jan 28, 2025

Problem

Some users shouldn't be able to login to Bileto. This can be because the users are deactivated, or because we want to hide Bileto to them.

Solution

Add an option in the user form to disable the login.

Specifications

The "prevent login" checkbox

Add a "DATETIMETZ_IMMUTABLE" attribute to the User entity named loginDisabledAt, set to null by default.

Add an unmapped checkbox "Prevent the user from logging in" to the App\Form\UserForm. If checked, it sets the value of loginDisabledAt to now.

When loginDisabledAt is set, it should also change the user password. This should allow to logout the corresponding user as explained in https://symfony.com/doc/current/security.html#understanding-how-users-are-refreshed-from-the-session

If the user cannot login, display the information in the user page (e.g. "Login disabled").

Disable login

In App\Security\FormLoginAuthenticator::authenticate, load the user right after getting the $userLoader. Check if the user can login, and raise an error CustomUserMessageAuthenticationException otherwise.

Disable reset password

A disabled user shouldn't be able to reset its password.

In App\Form\Password\ResetForm, fail if the user is disabled.

In App\Controller\PasswordsController::edit, fail if user is disabled.

Change email notifications

The email notifications invite the user to login to Bileto. If the user cannot login, we must remove these mentions from the email.

As the emails are actually sent to all the ticket's actors at once, we must change this behaviour in order to send individual emails.

Estimated time

1 - 2 days

@marien-probesys marien-probesys added the ready ✅ You can work on this! label Jan 28, 2025
@marien-probesys marien-probesys added this to the Version 0.15 milestone Jan 28, 2025
@marien-probesys marien-probesys self-assigned this Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready ✅ You can work on this!
Projects
None yet
Development

No branches or pull requests

1 participant