After registration, show log-in page


#1

After a user registers, they’re left on the registration page.

I would like to present them with the login page.

Is this possible?

Thanks


#2

One approach would be to add a redirect to the submitSuccess.ufForm event:

https://learn.userfrosting.com/client-side-code/components/forms#submitsuccess-ufform

and do something like:

$(location).attr('href', 'http://mysite.com/account/sign-in')

#3

Thanks, can I simply overwrite the specific functionality in my own sprinkle?


#4

Yes I believe so, I don’t have time at the moment to completely test it but you should be able to override the register form in your sprinkle and edit it’s

.\assets\userfrosting\js\pages\register.js

It already has the success event handler at the bottom of the file:

 // Handles form submission
    $("#register").ufForm({
        validators: registrationValidators,
        msgTarget: $("#alerts-page"),
        keyupDelay: 500
    }).on("submitSuccess.ufForm", function() {
        // Reload to clear form and show alerts
        window.location.reload();
    }).on("submitError.ufForm", function() {
        // Reload captcha
        $("#captcha").captcha();
    });

I would expect to be able to change

window.location.reload();

to your redirect to login.


#5

This would be a nice Core feature. Could be the same method as redirect.onLogin, but redirect.onRegister instead