2
Gem Design creates a login system with email and password. How do I change the form of email login to a code, ie instead of the user login by email it enter with a number or name?
2
Gem Design creates a login system with email and password. How do I change the form of email login to a code, ie instead of the user login by email it enter with a number or name?
1
Create a Migration to add the user name:
$ rails generate migration add_username_to_users username:string
Run the Migration:
$ rake db:migrate
Change the file /config/initializers/Devise.Rb by swapping :email for :username
config.authentication_keys = [ :username ]
Finally, change your view:
<li><%= f.label :username %> <%= f.text_field :username %></li>
Reference: railscasts
0
I haven’t had to do that yet, but there’s this wiki from Twitter that demonstrates how to use a username
(or code) to log in.
Browser other questions tagged ruby-on-rails ruby login devise
You are not signed in. Login or sign up in order to post.