简体   繁体   English

Ruby on Rails用户登录事件

[英]Ruby on Rails User Login Event

I'm using devise for user authentication. 我正在使用devise进行用户身份验证。 I would like to create a component to be able to respond to a user logging in. Does devise have user events or something similar? 我想创建一个组件来响应用户登录。devise是否具有用户事件或类似事件?

You can check out the pages here: Devise Wiki Pages . 您可以在此处检出页面: Devise Wiki Pages You can do things like redirect to certain pages. 您可以执行诸如重定向到某些页面的操作。 Additionally, when someone is logged in, so you can always check the current_user method provided by devise and see if it returns nil or a user. 此外,当某人登录时,您始终可以检查current_user提供的current_user方法,并查看它是否返回nil或用户。

Specifically look at redirecting on signin/signout. 具体看一下登录/注销时的重定向。 You can redirect to a controller action that does what you want. 您可以重定向到执行所需操作的控制器操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM