...
This commit is contained in:
parent
0848e5bd5d
commit
2fd01b6e9f
1 changed files with 3 additions and 3 deletions
|
@ -59,7 +59,7 @@ async fn root() -> &'static str {
|
||||||
"KOreader sync server"
|
"KOreader sync server"
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn create_user(Json(payload): Json<User>) -> (StatusCode, String) {
|
async fn create_user(Json(payload): Json<User>) -> (StatusCode, Json<Value>) {
|
||||||
let client = redis::Client::open("redis://127.0.0.1/").unwrap();
|
let client = redis::Client::open("redis://127.0.0.1/").unwrap();
|
||||||
let mut con = client.get_connection().unwrap();
|
let mut con = client.get_connection().unwrap();
|
||||||
|
|
||||||
|
@ -75,11 +75,11 @@ async fn create_user(Json(payload): Json<User>) -> (StatusCode, String) {
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
StatusCode::PAYMENT_REQUIRED,
|
StatusCode::PAYMENT_REQUIRED,
|
||||||
"Username is already registered.".to_owned(),
|
Json(json!({ "message" : "Username is already registered." })),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
(StatusCode::CREATED, format!("username = {username}"))
|
(StatusCode::CREATED, Json(json!({ "username" : username })))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn authorize(username: &str, password: &str) -> bool {
|
fn authorize(username: &str, password: &str) -> bool {
|
||||||
|
|
Loading…
Reference in a new issue