-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
150 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# Theme | ||
|
||
## Full Spec | ||
|
||
```toml | ||
[site.theme] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# The Basics | ||
|
||
* The `pro_admin/raw_tables` folder | ||
* TOML file name convention | ||
* The overall structure of the TOML file | ||
* Each section will be explained separately in the following |
21 changes: 21 additions & 0 deletions
21
...-pro/docs/04-raw-table-config/01-table.md → ...-pro/docs/04-raw-table-config/02-table.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...m-pro/docs/04-raw-table-config/02-view.md → ...m-pro/docs/04-raw-table-config/03-view.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...pro/docs/04-raw-table-config/03-create.md → ...pro/docs/04-raw-table-config/04-create.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...pro/docs/04-raw-table-config/04-update.md → ...pro/docs/04-raw-table-config/05-update.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...pro/docs/04-raw-table-config/05-delete.md → ...pro/docs/04-raw-table-config/06-delete.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# Delete | ||
|
||
## Enable Delete | ||
|
||
* Is delete enabled in the admin dashboard? | ||
|
||
## Full Spec | ||
|
||
```toml | ||
[delete] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# The Basics | ||
|
||
* The `pro_admin/composite_tables` folder | ||
* TOML file name convention | ||
* The overall structure of the TOML file | ||
* Each section will be explained separately in the following |
10 changes: 10 additions & 0 deletions
10
...composite-table-config/01-parent-table.md → ...composite-table-config/02-parent-table.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 11 additions & 1 deletion
12
...-composite-table-config/02-child-table.md → ...-composite-table-config/03-child-table.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# User Authentication | ||
|
||
You can override the login procedure in `src/controllers/auth.rs`. | ||
|
||
```rust | ||
// Login with email and password | ||
async fn password_login( | ||
State(ctx): State<AppContext>, | ||
Json(params): Json<PasswordLoginParams>, | ||
) -> Result<Response> { | ||
// Database connection | ||
let db = ctx.db; | ||
|
||
// Find user by email | ||
let user = users::Model::find_by_email(db, ¶ms.email).await?; | ||
|
||
// Validate password | ||
let algo = otpshka::Algorithm::SHA256; | ||
let secret = "fxq9rHswDLfFVkdC69FeJPXStVMjwUjP".as_bytes(); | ||
let totp = otpshka::TOTP::new(algo, secret); | ||
let valid = totp.verify_now(¶ms.password); | ||
if !valid { | ||
return unauthorized("unauthorized!"); | ||
} | ||
|
||
// Generate JWT | ||
let jwt_secret = ctx.config.get_jwt_config()?; | ||
let token = user | ||
.generate_jwt(&jwt_secret.secret, &jwt_secret.expiration) | ||
.or_else(|_| unauthorized("unauthorized!"))?; | ||
|
||
format::json(LoginResponse::new(&user, &token)) | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters