title: Devise Forgot password in bootstrap modal in a Rails Application
body: <p>I'm building a small app in Rails 4. I'm using devise for authentication. </p>
  
  <p>I want to set up my signin in a popup/popover window. I have used bootstrap modal to achieve that. I have followed this link to successfully achieve that.</p>
  
  <p><a href="https://github.com/plataformatec/devise/wiki/How-To:-Display-a-custom-sign_in-form-anywhere-in-your-app" rel="nofollow noreferrer">https://github.com/plataformatec/devise/wiki/How-To:-Display-a-custom-sign_in-form-anywhere-in-your-app</a> </p>
  
  <p>The following is my code</p>
  
  <p><strong>application.html</strong></p>
  
  <pre><code>    &lt;ul class="nav navbar-right"&gt;
        &lt;% if user_signed_in? %&gt;
           &lt;div id="loggedinuser"&gt; &lt;%= current_user.email %&gt;. Not you? &lt;/div&gt;
           &lt;%= link_to "Sign out", destroy_user_session_path, :method =&gt; :delete %&gt;
        &lt;% else %&gt;
           &lt;li&gt;&lt;a href="" data-toggle="modal" data-target="#myModal" class="btn btn-small btn-info"&gt;Log IN&lt;/a&gt;&lt;/li&gt;
        &lt;% end %&gt;
      &lt;/ul&gt;
  
  &lt;div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
  &lt;%= form_for(:user, :url =&gt; session_path(:user)) do |f| %&gt;
        &lt;%= f.email_field :email, class: 'form-control', placeholder: 'Enter email' %&gt;
        &lt;%= f.password_field :password, class: 'form-control', placeholder: 'Enter password' %&gt;
        &lt;%= f.submit 'Sign in', class: 'btn btn-block btn-info' %&gt;
   &lt;% end %&gt;
   &lt;%= link_to content_tag(:small, 'Forgot your password?'), new_password_path(:user) %&gt; 
  &lt;/div&gt;
  </code></pre>
  
  <p>The problem is with forgot password link. It takes me to password change path out of the modal popover.</p>
  
  <p>Is there any way I can open it in the same modal replacing the content?</p>
  
  <p>I saw the same question was asked here before but no one answered.</p>
  
  <p><a href="https://stackoverflow.com/questions/24878494/devise-forgot-password-popover-modal">https://stackoverflow.com/questions/24878494/devise-forgot-password-popover-modal</a></p>
  
  <p>I hope someone could help me this time.</p>
  
  <p>Any help is much appreciated.</p>