Rails 设计会议
在设计中,假设我想强制启动一个会话,而不检查电子邮件或密码是否正确,只是为特定用户启动一个会话,我该怎么做
(所以也许,用户通过 url 发送一个参数他的用户名,我将其传递给会话控制器中的一个函数,该函数为该用户启动一个会话)
我环顾四周,找不到这个问题的解决方案。
def create
name = params[:name]
user = User.where('name == :name', {:name => name})
user = user[0]
function to force session start
end
In devise, say if i wanted to force a session to start, not checking if email or password are right, just starting a session for a particular user, how would i that
(so maybe, the user sends in a parameter through the url with his username, i pass that to a function in my sessions controller, which starts a session for that user)
I've looked around and i can't find a solution for this problem.
def create
name = params[:name]
user = User.where('name == :name', {:name => name})
user = user[0]
function to force session start
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用sign_in函数
You can use the sign_in function