Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs #563

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading