Question: I found a way to customize devise to use username to login instead of email address.  

But actually I want to use combination :- 

```
Enter username or Email:   <text-box>
Enter your password    :   <text-box>  

```

So how to achieve this ? 

Actually we need to modify devise gem's configuration to support this.  

for now I know that modifying the "/config/initializers/devise.rb" file as 

```
config.authentication_keys = [ :username ] (edited from email to username.)  

```

would actually enable logging in using username instead of emailid.  

But can I do some thing like:- 

```
config.authentication_keys = [ :username | :email] in the "config/initializers/devise.rb" file.  

```

So that we devise can take username or email as authentication key at runtime depending on the input provided by user.  

Thanks in advance .

Answer: 
how about filtering on the username or email if there is an @ and a . which would be characteristics for an email.
You can use this guide <https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign-in-using-their-username-or-email-address>

but remember to change :authentication\_keys => [:username] at devise model or at devise.rb as suggested by the guide to :authentication\_keys => [:login] to make it work

Regards