Redirect User to Signup

Should I redirect user to sign in page after sign up or to the home page?

It would highly depend on what your website is about and what is the user flow journey. Also, why do users have to register at your website.

Is your website a SaaS? If yes, high chance your user would want to go to the dashbaord.

Is your website is a news site? If yes, high chance your user would want to go to the homepage to read the news.

The location your app should redirect to is dependent on why the user would be required to sign in, and what the user is expected to be doing next.

How to redirect user to another page after successfully SignUp or SignIn in Firebase and HTML

redirect
javascript:

window.location = 'mysite'

html form:

<input type="submit" target="mysite" value="Sign in"/>

html meta:

<meta http-equiv="refresh" content="time; URL=new_url" />

php:

<?php
header('Location: mysite');
exit;
?>

firebase:

"hosting": {
// ...

// Returns a permanent redirect to "/bar" for requests to "/foo" (but not "/foo/**")
"redirects": [ {
"source": "/foo",
"destination": "/bar",
"type": 301
} ]
}

How To Redirect Logged In User To My Account If They Visit To Login & Signup Page?

Your OR condition need to be in parenthesis. Currently you check for "is login page OR the three other condition". That's why you always redirect to my account page when going to login.

This should do the trick:

if ( (is_page('login') || is_page('signup')) && is_user_logged_in() && wc_user_has_role( $user, 'customer')) {

Redirect User to Signup

What you are looking for is a referer.
Having your before_filter working, you can override the Devise's after_sign_up_path_for:

def after_sign_up_path_for(user)
request.referer
end


EDIT

Since request.referer is somehow not working, I think you could go with a session-based solution:

def auth_user
session[:before_sign_up_path] = request.fullpath
redirect_to new_user_registration_url unless user_signed_in?
end

def after_sign_up_path_for(user)
session[:before_sign_up_path]
end

how do i redirect to user profiles upon signup with django

Pass the actual values for slug and pk in your redirect, and it should work:

return redirect(f'/profile/{user.profile.slug}/{user.pk}')


Related Topics



Leave a reply



Submit