jeudi 14 juillet 2016

login with devise with 2 params in one field Rails

i want to login with a dynamic field like i did it here:

<%= form_tag(dynamic_login_path, method: "post", id: "login_cellphone_email") do %>

        <div class="form-group">
            <%= text_field :cellphone_email, "", :class => 'form-control', :id => 'email-phone-login', :placeholder => 'Enter a email or cellphone' %>
        </div>

        <div class="form-group">
            <%= password_field :password, "", :class => 'form-control', :id => 'password-login', :placeholder => 'Enter your password' %>
        </div>

        <%= submit_tag 'Check', :class => 'btn btn-default btn-block' %>
 <% end %>

here i make a form with a field that can be the email or cellphone then in the controller i check if its a email or cellphone and if its i check for the user who has this email/cellphone and this password but i want to use devise now for the sessions but i dont know if i can do this on it, i can?

Aucun commentaire:

Enregistrer un commentaire