0
不能只是做User.where(:email => email, :password => password)
因为密码不是以纯文本格式存储的。给出纯文本电子邮件和密码,如何检查用户是否存在这些凭据?
不能只是做User.where(:email => email, :password => password)
因为密码不是以纯文本格式存储的。给出纯文本电子邮件和密码,如何检查用户是否存在这些凭据?
获取用户从数据库中:
User.find_by_email(PARAMS [:邮箱]) 然后,您可以检查自己的密码 有:
user.valid_password(PARAMS [:密码])
从How can I simply verify that a username and password are correct with Devise and Rails 3