doc: added documentation for the path
This commit is contained in:
parent
bfe96f0f2c
commit
04853f439b
2 changed files with 45 additions and 2 deletions
43
README.md
43
README.md
|
@ -54,6 +54,49 @@ Invalid Auth:
|
||||||
|
|
||||||
Generic responses which is used unless otherwise specified above.
|
Generic responses which is used unless otherwise specified above.
|
||||||
|
|
||||||
|
### POST /ldap/reset
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"user" : "[OPTIONAL] username looking for reset",
|
||||||
|
"email" : "[OPTIONAL] email looking for reset"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
All responses:
|
||||||
|
```json
|
||||||
|
{"result": "success"}
|
||||||
|
```
|
||||||
|
|
||||||
|
### POST /ldap/reset/auth
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"auth" : "Auth key from teh email",
|
||||||
|
"pass" : "Password the user chooses"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Early Errors:
|
||||||
|
```json
|
||||||
|
{"result": "error"}
|
||||||
|
```
|
||||||
|
|
||||||
|
LDAP error:
|
||||||
|
```json
|
||||||
|
{"result": "error", "error": "ldap error"}
|
||||||
|
```
|
||||||
|
|
||||||
|
Success:
|
||||||
|
```json
|
||||||
|
{"result": "success", "success": "Password set"}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Responses
|
||||||
|
|
||||||
|
Generic responses which is used unless otherwise specified above.
|
||||||
|
|
||||||
|
|
||||||
### Success: HTTP 200
|
### Success: HTTP 200
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,13 +87,13 @@ pub async fn post_password_auth(mut req: Request<State>) -> tide::Result {
|
||||||
let db = &req.state().db;
|
let db = &req.state().db;
|
||||||
|
|
||||||
if db_pending_clear_expired(db).await.is_err() {
|
if db_pending_clear_expired(db).await.is_err() {
|
||||||
return Ok(json!({"result": "success"}).into());
|
return Ok(json!({"result": "error"}).into());
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if auth exists
|
// check if auth exists
|
||||||
let details = match db_get_user_reset_auth(db, &auth).await {
|
let details = match db_get_user_reset_auth(db, &auth).await {
|
||||||
None => {
|
None => {
|
||||||
return Ok(json!({"result": "success"}).into());
|
return Ok(json!({"result": "error"}).into());
|
||||||
}
|
}
|
||||||
Some(x) => x,
|
Some(x) => x,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue