> For the complete documentation index, see [llms.txt](https://docs.matestack.io/matestack-ui-bootstrap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.matestack.io/matestack-ui-bootstrap/2.1/integrations/devise.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
