Hi everyone,
I have a question. I want openedx to redirect students to login screen instead of learner dashboard after registration.
Could anyone give me some input on where/how I can do that?
Your help is very much appreciated.
Thanks,
Hi everyone,
I have a question. I want openedx to redirect students to login screen instead of learner dashboard after registration.
Could anyone give me some input on where/how I can do that?
Your help is very much appreciated.
Thanks,
I believe learners are logged in upon registration. Could you describe more about what you want to do and why?
Hi @sarina ,
Thanks for the reply.
I want the learners to go through login process after registration (take them to login screen instead of student dashboard after registration). I want them to confirm email before able to login to make sure they are the owner of the email. If they don’t own the email, they shouldn’t be able to see student dashboard even once.
Thanks,
I apologize, I don’t know how to do that. Maybe someone else does.
Hi @kanharithsok,
I understand your point and agree with it. In my opinion, students should confirm their email addresses before gaining access to the platform. But the default is to redirect to the dashboard.
The registration process returns a payload object to the user with a key called next. This key defines the redirection URL after registration. The default is /dashboard when there is none. This occurs in the frontend-app-authn package, if you are using the MFE. See the link below:
frontend-app-authn/src/register/data/service.js:22#release/teak
To change this behaviour, I patched the frontend-app-authn, more specifically the file RegistrationPage.jsx and added a line including the next key to the payload object. Something like this:
// Force logout after registration using next=/logout
payload.next = '/logout'; // <----- Add this line
// Preparing payload for submission
payload = prepareRegistrationPayload(
payload,
configurableFormFields,
flags.showMarketingEmailOptInCheckbox,
totalRegistrationTime,
queryParams);
This redirects the browser to the /logout URL and log out the user. To access the platform again, it’s necessary to confirm the email.
This is not the best approach, but it’s the simplest one that I could find. If anyone knows something easier, please share here with us.
Be aware that this is not a security solution! This is just a workaround! The next parameter is used by the OpenedX to replace the URL. If you manipulate the response, you can easily bypass this behaviour, and the client can keep the session valid. Possibly there is a more secure way to do this.
Hope this helps!
I looked into this a few months ago and I couldn’t find any settings that controlled that. I think this is just a feature that needs to be added. (I personally find the existing behavior really weird and think it’s strange that there’s not even an option to require email verification before first login, but… as far as I can tell, that’s just how the code currently is.)
Hi @Tim_McCormack,
I couldn’t find either. The easiest solution I could find was this one above.
There is a variable POST_REGISTRATION_REDIRECT_URL in the frontend-app-authn package that possibly could be used for this. But to use it, you need to activate the ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN, send a host parameter in the request, etc. Too complicated, and I didn’t want to use the progressive profiling. Furthermore, I think I had some unexpected side effects with it.
Perhaps, I was misusing this feature and configuring wrongly, but it didn’t work for me. So, I decided to go through this simple patch solution.