Readme info
This commit is contained in:
parent
51d88246cd
commit
0981a71b87
10
Readme.md
10
Readme.md
@ -9,6 +9,12 @@ This library is my attempt at developing a recyclable utility for different proj
|
|||||||
Setup:
|
Setup:
|
||||||
- Add this library to your Cargo.toml
|
- Add this library to your Cargo.toml
|
||||||
- Copy the migrations from the migrations folder inside this library into your migrations
|
- Copy the migrations from the migrations folder inside this library into your migrations
|
||||||
- Add the user_lib::setup() function to your main. Make sure to pass it a PgPool
|
- Run the migrations
|
||||||
- Add the user_lib::routes to your actix_web server (register, authenticate, change_password, refresh_token)
|
|
||||||
Usage:
|
Usage:
|
||||||
|
- A user can have many credentials (Currently only 3, one for each CredentialType: Username, Email, PhoneNumber)
|
||||||
|
- Register a user with `register_user().await` This function returns a Token that holds an Auth token that's usable for 7 days and a Refresh token in case the auth expires.
|
||||||
|
- Authenticate a user with their id and auth_token using `authenticate_user().await`
|
||||||
|
- If that's expired use `refresh_token().await`
|
||||||
|
- If you want another token then use `password_login().await`
|
||||||
|
- `reset_password().await` To reset password with current password
|
||||||
|
- `force_reset_password().await` To reset password without knowing the password (YOU MUST IMPLEMENT YOUR OWN WAY OF VALIDATING THAT USER'S IDENTITY)
|
@ -180,3 +180,8 @@ pub async fn authenticate_user(db_conn: &sqlx::PgPool, user: AuthenticateUserDto
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn refresh_auth_token() {}
|
||||||
|
|
||||||
|
pub async fn reset_password() {}
|
||||||
|
|
||||||
|
pub async fn password_login() {}
|
Loading…
Reference in New Issue
Block a user