如何通过电子邮件对用户进行身份验证? [英] How to authenticate the user from the email?
问题描述
我有一个使用devise进行身份验证的Rails应用程序.当应用程序向用户发送任何通知时,为了查看通知或消息,我提供了指向我的Rails应用程序的链接,该链接重定向到登录页面.
I have a rails application which uses devise for authentication. when the application sends any notification to the user, then in order to see the notification or messages i provide a link to my rails application which redirects to a login page.
我如何避免此登录过程,这意味着我不希望通过输入电子邮件和密码来要求用户登录,而是每当用户单击该链接时,用户都应自动登录.
how can i avoid this login process, means i don't want the user to be asked to login by entering email and password, instead whenever the user clicks on that link, then the user should automatically login.
推荐答案
Devise提供了sign_in
控制器帮助器,该帮助器允许您以编程方式通过身份验证.
Devise provides sign_in
controller helper which allows you to pass authentication programmatically.
sign_in(user)
这篇关于如何通过电子邮件对用户进行身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!