设计注册自动登录用户 [英] devise sign up automatically signs in user

查看:149
本文介绍了设计注册自动登录用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我注册一个用户,但是还没有可确认的设置(即将来会被注释掉),是否自动登录用户?

when i sign up a user, but don't have confirmable setup just yet (i.e. will be in the future but commented out for now), does it automatically sign in the user?

我需要sign_up才能登录用户,但不登录他,需要重定向到登录页面,我如何注册以不登录用户?

i need sign_up to just sign_up the user, but not sign him in, it needs to redirect to the login page, how do i get sign up to not log the user in?

推荐答案

而不是复制粘贴代码并替换一行(可能难以维护),只需覆盖after_sign_up_path_for(资源),因此它使用after_sign_in_path_for资源):

Instead of copy pasting code and replacing one line (which could be harder to maintain), just override the after_sign_up_path_for(resource), so it uses the after_sign_in_path_for(resource) instead:

def after_sign_up_path_for(resource)
    after_sign_in_path_for(resource)
end

这篇关于设计注册自动登录用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆