简体   繁体   English

在 Rails 6 中可以使用两种模式来验证 devise 用户吗?

[英]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.我有一个 Rails 6 应用程序,其中包括 devise 和简单的身份验证表单。 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.电子邮件将在一个模式中验证,如果 email 存在,将链接到另一个验证密码的模式。 Google gmail uses this login strategy for example.例如,谷歌 gmail 使用这种登录策略。

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.我试图创建一个在本教程之后设计的单一模式使用 Ajax 破解你的 Rails 5 注册表单,让用户在单一引导模式中登录。

<!-- 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.我正在努力使用 devise 身份验证。 How can I validate a user's email in one modal, which will then link to another modal for password validation?如何在一个模式中验证用户的 email,然后链接到另一个模式以进行密码验证?

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.我将研究 wicked gem,它是一个向导插件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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