-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Ability to specify flash messages upon redirects #101
Comments
Off-topic: I am using Passwordless for the first time and I am really loving it! Thanks @mikker and everyone else for your amazing work! I really look forward to contribute. |
It looks like there aren't any flashes set for those items. I think you have two options.
or
def show
# Make it "slow" on purpose to make brute-force attacks more of a hassle
BCrypt::Password.create(params[:token])
sign_in(passwordless_session)
flash_if_key(:success, ".passwordless.sessions.create.signed_in")
redirect_to(passwordless_success_redirect_path)
rescue Errors::TokenAlreadyClaimedError
flash_if_key(:error, ".passwordless.sessions.create.token_claimed")
redirect_to(passwordless_failure_redirect_path)
rescue Errors::SessionTimedOutError
flash_if_key(:error, ".passwordless.sessions.create.session_expired")
redirect_to(passwordless_failure_redirect_path)
end
private def flash_if_key(flash_type, i18n_key)
flash[flash_type] = I18n.t(i18n_key) if I18n.t(i18n_key, default: nil).present?
end |
It doesn't seem as though this issue is fully completed. While a flash is generated for unsuccessful new session and token authentication, a flash for successful authentication and destroy is not implemented. |
I'm not sure they're needed? IMO, if it works it would be pretty self evident. Not completely sure I'm right now so feel free to try and convince me otherwise. |
Hello everyone. I wasn't able to figure out how to set flash messages when user is redirected after actions like successful login, failure or sign out.
My use case would be something like "Welcome back!" or "You are logged out, see you soon".
Is there a way to do this?
The text was updated successfully, but these errors were encountered: