Merry Christmas. I am making a website and I want to change the view past-login with JavaScript.
The code responsible for detecting a valid login attempt looks like this:
def messages(status_OK, status_400, status_401, filtered_data):
# change page after signup
if filtered_data[0] == 'method=sign_up':
if filtered_data[1] == 'username=' or filtered_data[2] == 'password=' or filtered_data[3] == 'email=':
with open('status/error/signup_400.html', 'rb') as err: response = err.read()
return status_400 + response
with open('status/signup_success.html', 'rb') as success: response = success.read()
return status_OK + response
# change page after login
elif filtered_data[0] == 'method=login_name':
if postlogin.username():
with open('status/username_success.html', 'rb') as success: response = success.read()
return status_OK + response
elif filtered_data[1] == 'username=' or filtered_data[2] == 'password=':
with open('status/error/username_400.html', 'rb') as err: response = err.read()
return status_400 + response
else:
with open('status/username_failed.html', 'rb') as fail: response = fail.read()
return status_401 + response
elif filtered_data[0] == 'method=login_email':
if postlogin.username():
with open('status/email_success.html', 'rb') as success: response = success.read()
return status_OK + response
elif filtered_data[1] == 'email=' or filtered_data[2] == 'password=':
with open('status/error/email_400.html', 'rb') as err: response = err.read()
return status_400 + response
else:
with open('status/email_failed.html', 'rb') as fail: response = fail.read()
return status_401 + response
I want it to do more than just returning another webpage, specifically, I want it to execute JS on the front-end to set a flag that changes the webpage view ACCORDING TO THE MENTIONED CODE ^^^^^^^
So, how do I do it?
I know how to change the view, I just need a way to execute JS on the front-end without needing user actions.