RoR Devise: Sign in with username OR email

前端 未结 11 2732
渐次进展
渐次进展 2020-12-07 10:15

What\'s the best way to enable users to log in with their email address OR their username? I am using warden + devise for authentication. I think it probably won\'t be too h

11条回答
  •  北荒
    北荒 (楼主)
    2020-12-07 10:52

    Platforma Tec (devise author) has posted a solution to their github wiki which uses an underlying Warden authentication strategy rather than plugging into the Controller:

    https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign-in-using-their-username-or-email-address

    (An earlier answer had a broken link, which I believe was intended to link to this resource.)

提交回复
热议问题