[英]Need To redirect At home page If user Already logged in
我使用omniauth
用devise
。 我的控制器在下面
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def facebook
# You need to implement the method below in your model (e.g. app/models/user.rb)
@user = User.from_omniauth(request.env["omniauth.auth"])
if @user.persisted?
sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated
set_flash_message(:notice, :success, :kind => "Facebook") if is_navigational_format?
else
# session["devise.facebook_data"] = request.env["omniauth.auth"]
redirect_to new_user_registration_url
end
end
end
如果用户已经登录并坚持下去,这会将用户重定向到注册页面。我要进行哪些更改以将用户重定向到首页......... ?????? 请帮帮我
登录后路径设置了吗?
#application_controller.rb
def after_sign_in_path_for(resource_or_scope)
case resource_or_scope
when :user, User
root_path
else
super
end
end
如果您遇到其他错误,请粘贴在这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.