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

How to display error messages on the login screen? #46

Open
Reddaxi opened this issue Mar 17, 2022 · 0 comments
Open

How to display error messages on the login screen? #46

Reddaxi opened this issue Mar 17, 2022 · 0 comments

Comments

@Reddaxi
Copy link

Reddaxi commented Mar 17, 2022

Hello

I'd like to make a flow that doesn't log the user in on authentication.
The ideal flow would be:

  1. User clicks "Sign in with Active Directory"
  2. User is redireced and completes the Azure login flow
  3. User is redirected to my Umbraco application, where the autolinking occurs. I create the user, grant them basic rights and set them as disabled (I didn't find a setting for this, so I opted to just set them as locked out instead)
  4. The user is redirected to the umbraco login page with the error message "Your user is locked. Please contact an administrator to gain access."
  5. An Umbraco admin logs into umbraco, finds the linked user, unlocks them and grants them appropriate access.

My only issue thus far is that when I lock the user, they are redirected to the login page, but with no error message.
By reading into the documentation and debugging, I've come up with a "solution" where i edit the Umbraco/default.cshtml file to look for error message that I register in the HttpContext, however I'd much prefer to not edit Umbraco files that will get overwritten with future updates.

Reading through other issues, I came across #24, which is close to what I want.
I found that throwing an exception doesn't solve my issue.

If I throw within OnAutoLinking, it does actually show an error on the login page, however it cancels the linking.
If I throw withing OnExternalLogin, a yellow screen of death is shown.

So - TL;DR
How do I, within the OnExternalLogin and OnAutoLinking register a message that I can show to the user on the login screen?

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

No branches or pull requests

1 participant