Skip to content

Commit

Permalink
Update docs (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
harishmohanraj authored Nov 12, 2024
1 parent 28e4890 commit afea9a0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions docs/docs/en/user-guide/ui/mesop/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ Finally, we instantiate **[MesopUI](../../../../api/fastagency/ui/mesop/MesopUI.

1. User Setup:

- The **`allowed_users`** parameter accepts a dictionary that maps usernames (e.g., emails) to their [**bcrypt-hashed**](https://en.wikipedia.org/wiki/Bcrypt){target="_blank"} passwords.
- The **`allowed_users`** parameter accepts a dictionary that maps usernames to their [**bcrypt-hashed**](https://en.wikipedia.org/wiki/Bcrypt){target="_blank"} passwords.
- Only bcrypt hashing is supported; other hashing algorithms (like MD5 or SHA-256) will not work with [**`BasicAuth`**](../../../../api/fastagency/ui/mesop/auth/basic_auth/BasicAuth.md) class.

2. Hashing Passwords with Bcrypt:
Expand All @@ -274,15 +274,15 @@ Finally, we instantiate **[MesopUI](../../../../api/fastagency/ui/mesop/MesopUI.

```py
allowed_users = {
"harish@airt.ai": "$2y$10$4aH/.C.WritjZAYskA0Dq.htlFDJTa49UuxSVUlp9JCa2K3PgUkaG" # nosemgrep
"harish": "$2y$10$4aH/.C.WritjZAYskA0Dq.htlFDJTa49UuxSVUlp9JCa2K3PgUkaG" # nosemgrep
}
```

In this example, the hash is generated from `someStrongPassword` for the user `harish@airt.ai`.
In this example, the hash is generated from `someStrongPassword` for the user `harish`.

**Authenticating in the Mesop Web App**

To log in, users should enter their **original passwords** (e.g., `someStrongPassword` for `harish@airt.ai`) on the Mesop application’s login screen. The `BasicAuth` class then verifies the password by comparing its bcrypt hash with the stored hash in `allowed_users`. If the hashes match, the user is successfully authenticated.
To log in, users should enter their **original passwords** (e.g., `someStrongPassword` for `harish`) on the Mesop application’s login screen. The `BasicAuth` class then verifies the password by comparing its bcrypt hash with the stored hash in `allowed_users`. If the hashes match, the user is successfully authenticated.

=== "Firebase Authentication"
```python hl_lines="29-36 39-44 46"
Expand Down
2 changes: 1 addition & 1 deletion docs/docs_src/user_guide/ui/mesop/main_mesop_basic_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def simple_workflow(
# bcrypt-hashed passwords. One way to generate bcrypt-hashed passwords
# is by using online tools such as https://bcrypt.online
allowed_users={
"harish@airt.ai": "$2y$10$4aH/.C.WritjZAYskA0Dq.htlFDJTa49UuxSVUlp9JCa2K3PgUkaG", # nosemgrep
"harish": "$2y$10$4aH/.C.WritjZAYskA0Dq.htlFDJTa49UuxSVUlp9JCa2K3PgUkaG", # nosemgrep
"[email protected]": "$2y$10$Yz9GuF/bWmRFmnXFkauOwePT/U.VSUHdpMOX7GPB8GiklJE4HJZmG" # nosemgrep
}
)
Expand Down
3 changes: 3 additions & 0 deletions javascript/basic_auth_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ class BasicAuthComponent extends LitElement {
if (form) {
form.reset();
}

// Refresh the browser
window.location.reload();
} catch (error) {
console.error("Sign out error:", error);
}
Expand Down

0 comments on commit afea9a0

Please sign in to comment.