# Devise

Please review the general guide on how to integrate `Devise` into Matestack within the docs of `matestack-ui-core`.

Below you find examples implementing typical Devise views with `matestack-ui-bootstrap`

## Login Page

```ruby
class Devise::Pages::SignIn < Matestack::Ui::Page

  def response
    bs_container class: "mt-5" do
      bs_row class: "mt-5", vertical: :center, horizontal: :center do
        bs_col md:4 do
          login_form_partial
        end
      end
    end
  end

  private

    def login_form_partial
      section class: "mt-5 rounded shadow-sm p-4 mb-4" do
        heading size: 2, text: 'Sign in'
        matestack_form form_config do
          div class: "mb-3 mt-4" do
            bs_form_input label: 'Email', key: :email, type: :email
          end
          div class: "mb-3" do
            bs_form_input label: 'Password', key: :password, type: :password
          end
          div class: "mb-3" do
            bs_form_submit text: "Sign in"
          end
        end
        toggle show_on: 'sign_in_failure' do
          plain 'Your email or password is not valid.'
        end
      end
    end

    def form_config
      {
        for: :admin,
        method: :post,
        path: admin_session_path,
        delay: 500,
        success: {
          redirect: {
            follow_response: true
          }
        },
        failure: {
          emit: 'sign_in_failure'
        }
      }
    end

end
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.matestack.io/matestack-ui-bootstrap/2.1/integrations/devise.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
