Skip to content

[6.x] Elevated Sessions #11688

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

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft

[6.x] Elevated Sessions #11688

wants to merge 12 commits into from

Conversation

duncanmcclean
Copy link
Member

@duncanmcclean duncanmcclean commented Apr 10, 2025

This pull request introduces the concept of "elevated sessions", which prompts you for your password before allowing you to take certain actions. Similar to GitHub's sudo mode.

TODO: Screenshot

After "starting" an elevated session, you won't be prompted for your password again until the session expires. By default, elevated sessions last for 15 minutes.

For now, I've implemented this in front of the following actions:

  • Changing another user's password
  • Copying a password reset link
  • Updating permissions on a role

We'll also use this in #11664 before allowing you to view recovery codes, or deactivate 2FA on your account.

Extending

Addon developers can require elevated sessions in their code by applying the RequireElevatedSession middleware to applicable routes, and using the HasElevatedSession mixin.

Route::get('foo', [FooController::class, 'index'])
  ->middleware(RequireElevatedSession::class);
mixins: [HasElevatedSession],

methods: {
    submit() {
        this.requireElevatedSession().then(() => this.actuallySubmit());
    },
    actuallySubmit() {
        // ...
    }
}

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.

1 participant