简体   繁体   中英

Can two modals be used to authenticate a devise user in Rails 6?

I have a Rails 6 application which includes devise and simple form for authentication. My goal is to use two modals to authenticate a user. Emails will be validated in one modal, which, if the email exists, will link to another modal where the password is validated. Google gmail uses this login strategy for example.

I have tried to create aa single modal designed after this tutorial Hack your Rails 5 Signup Form with Ajax , which let's users login in a single bootstrap modal.

<!-- Modal -->
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      
      <div class="modal-body">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      
        <%= simple_form_for(resource, as: resource_name, url: session_path(resource_name), remote: true, :html => {:class => 'form-horizontal' }) do |f| %>
          <div class="form-inputs">
            <div class="errors"></div>
            <%= f.input :email,
                        required: true,
                        autofocus: true,
                        input_html: { class: "inputStyling" } %>

            <%= f.input :password,
                        required: true,
                        input_html: { class: "inputStyling" } %>
            
          </div>
          <div class="form-actions">
            <%= f.button :submit, "Continue", :class => "create", %>
          </div>
        <% end %>
      </div>
      <div class="modal-footer">
<!--- Add omni authentication -->
      </div>
    </div>
  </div>
</div>

Edit I want to clarify my question. I am struggling with devise authentication. How can I validate a user's email in one modal, which will then link to another modal for password validation?

I think I can just use a form wizard to accomplish what I want to do. I will look into wicked gem which is a wizard plugin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM