> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/health/ph-v1.7/deploy/configuration/ui-configuration/login.md).

# Login

### 📘 Overview

The **Login** screen enables users to access the Health Campaign Management (HCM) app by entering their User ID and password. It also provides a **Forgot Password** option that informs users to contact their administrator since the app doesn’t handle password resets directly.

***

### 🔁 Workflow Details

#### Entry Point

* Users are redirected to the login screen immediately after selecting their preferred language.

<div align="left"><figure><img src="https://3060978721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FugLvZh3s3IGcc8JYqNN7%2Fuploads%2FCGEirE9V6tHfU766VEXA%2Fimage.png?alt=media&amp;token=42300964-586a-4f86-bdad-348221913b20" alt="" width="207"><figcaption></figcaption></figure></div>

#### User Actions

* **Input Credentials**: User enters **User ID** and **Password**.
* **Login**: Clicks **"Log In"** to authenticate with the backend.
* **Forgot Password**: Clicks the **"Forgot Password"** button (no password reset performed within the app; displays informational dialogue).

***

### ⚙️ Technical Implementation

#### UI Components

* **Login Screen**: Defined in\
  `health_campaign_field_worker_app/lib/pages/login.dart`&#x20;
* **Widgets Used**:
  * **DigitTextFormField**: Input fields for user ID and password&#x20;
  * **DigitElevatedButton**: Login button component&#x20;
  * **DigitToaster (SnackBar)**: Notification for login success, failure, or errors

#### Dialogue Integration

* The “Forgot Password” button triggers a **DigitDialog**, displaying a message prompting users to contact their administrator.

***

### 🔐 API Role–Action Mapping

| Action               | API Endpoint                       | Description                                                                               |
| -------------------- | ---------------------------------- | ----------------------------------------------------------------------------------------- |
| Login Authentication | `POST /auth/login` (or equivalent) | Sends credentials (`userID`, `password`) to authenticate user and return a session token. |
| Forgot Password      | –                                  | No backend call; purely client‑side informational dialog                                  |

* **Login Payload Example**:

  ```json
  {
    "RequestInfo": { "authToken": "" },
    "User": {
      "userId": "string",
      "password": "string"
    }
  }
  ```
* **Login Response**: Returns a user token and possibly user role/context data to establish a session and navigation flow.
* **Access Management**: The returned authentication token governs user access across the application.


---

# 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.digit.org/health/ph-v1.7/deploy/configuration/ui-configuration/login.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.
