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
redirectjavascript
:
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
How to Beautify Xml Code in Rails Application
How to Globally Ignore Invalid Byte Sequences in Utf-8 Strings
In a Sinatra App on Heroku, Session Is Not Shared Across Dynos
How to Get a Remote-File's Mtime Before Downloading It in Ruby
How to Run a Simple File on Heroku
Setting Environment Variables with Puppet
How to Configure Config.Yml So That I Can Install Devkit
Is There a Ruby One-Line "Return If X"
Have Devise Create a Subdomain on Registration
Ruby, Using Regex to Find Something in Between Two Strings
Rails Return JSON Serialized Attribute With_Indifferent_Access
Elasticsearch Terms Aggregation by Entire Field
Consuming Non-Rest APIs in Rails with Activeresource
Gem Install Mongrel Fails with Ruby 1.9.1