Skip to content

Use constants for status changes in the session #408

Closed
@dwightwatson

Description

@dwightwatson

This is semi-related to #341 but more specifically about having to do string comparisons on the session to present the correct messaging to users. I'm working on migrating to Fortify without Jetstream so I'm involved in the nitty-gritty deals of rolling my own UI.

I wonder if perhaps these session strings could be abstracted into constants. It would make the abstraction less leaky (and I don't need to worry about internal changes to Fortify), with the added benefit of making it clear that this status change is coming out of Fortify.

// Could we ditch this...
@if (session('status') == 'two-factor-authentication-enabled')

// ...for this?
@if (session('status') === Fortify::TWO_FACTOR_AUTHENTICATION_ENABLED)

Fortify does this in a number of places (including password updates, profile updates and verification links being updated) but my specific interest is the interactions with 2FA.

Happy to PR this if you're open to the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions