style: use the same response for login/register
This commit is contained in:
parent
0b25e3fb87
commit
aea640a64c
2 changed files with 6 additions and 13 deletions
|
@ -16,10 +16,9 @@ struct LoginInformation {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
struct Response {
|
pub struct Response {
|
||||||
access_token: String,
|
pub access_token: String,
|
||||||
expires_in: u64,
|
pub refresh_token: String,
|
||||||
refresh_token: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const MAX_SIZE: usize = 262_144;
|
const MAX_SIZE: usize = 262_144;
|
||||||
|
@ -111,9 +110,8 @@ async fn login(data: actix_web::web::Data<Data>, uuid: String, request_password:
|
||||||
}
|
}
|
||||||
|
|
||||||
return HttpResponse::Ok().json(Response {
|
return HttpResponse::Ok().json(Response {
|
||||||
access_token: "bogus".to_string(),
|
access_token,
|
||||||
expires_in: 0,
|
refresh_token,
|
||||||
refresh_token: "bogus".to_string(),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ use uuid::Uuid;
|
||||||
use argon2::{password_hash::{rand_core::OsRng, SaltString}, PasswordHasher};
|
use argon2::{password_hash::{rand_core::OsRng, SaltString}, PasswordHasher};
|
||||||
|
|
||||||
use crate::{crypto::{generate_access_token, generate_refresh_token}, Data};
|
use crate::{crypto::{generate_access_token, generate_refresh_token}, Data};
|
||||||
|
use super::login::Response;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct AccountInformation {
|
struct AccountInformation {
|
||||||
|
@ -48,12 +49,6 @@ impl Default for ResponseError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
|
||||||
struct Response {
|
|
||||||
access_token: String,
|
|
||||||
refresh_token: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
const MAX_SIZE: usize = 262_144;
|
const MAX_SIZE: usize = 262_144;
|
||||||
|
|
||||||
#[post("/register")]
|
#[post("/register")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue