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

Evil Portal - URL Results Parameter #510

Open
jamescussen opened this issue Mar 11, 2024 · 0 comments
Open

Evil Portal - URL Results Parameter #510

jamescussen opened this issue Mar 11, 2024 · 0 comments

Comments

@jamescussen
Copy link

An improvement for the Evil Portal (i'm using the esp32_marauder version) is to include a result parameter in the returned redirect page.

This will allow for a "You are now signed in" page to be shown after the sign in process, or to present error messages if the email/password provided is not suitable.

The specific code is below and just needs to include a parameter in the window.location.href:

request->send(
      200, "text/html",
      "<html><head><script>setTimeout(() => { window.location.href ='/' }, 100);</script></head><body></body></html>");
  });

Here are some examples of return results that could be included:

"/?result=success" - This is when the user has provided an email address and password text successfully.

"/?result=email-error" - Do a regex test on the inbound email to check the format. If it's not formatted correctly respond with this error.

"/?result=email-blank" - The email field was blank

"/?result=password-blank" - The password field was blank

"/?result=general-failure" - Any other failure allows for a general error message.

In the index.html file you can use javascript to get these parameters and render a different page in response:

const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const result = urlParams.get('result')

document.addEventListener("DOMContentLoaded", function(){
	if(result == "success"){
		//Render page elements appropriately.
	}
});
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