質問

I followed the instructions for adding a username login instead of email (actually in addition to email) for Devise. Problem is when I go to actually sign in, there's a Javascript mechanism to make the login field red when a non-email address is entered. Then when you click the sign in button, there's Javascript to prevent you from signing in and presents a black bubble stating, "Please enter an email address".

Did I do something wrong? Are those Devise instructions out of date? How do I allow users to enter usernames instead of email addresses to login? I'm using the latest Devise and Rails (v3.2.8).

役に立ちましたか?

解決

I think you did something wrong. I implemented a login similar to what you're describing recently and it worked just fine.

It sounds like you need to edit your devise templates. Have you generated them already? If so, you need to change the field types to text fields wherever you have an email field and make sure you're referencing 'login' instead of email.

The "Update your views" section of that link explains how to do that.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top