summaryrefslogtreecommitdiff
path: root/src/api/auth.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/auth.rs')
-rw-r--r--src/api/auth.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/api/auth.rs b/src/api/auth.rs
index 253e982..410b643 100644
--- a/src/api/auth.rs
+++ b/src/api/auth.rs
@@ -5,16 +5,16 @@ use tower_cookies::{Cookies, Cookie};
use crate::types::{user::User, response::ResponseCode, session::Session, extract::{Json, AuthorizedUser, Check, CheckResult, Log}};
-#[derive(Deserialize)]
-struct RegistrationRequet {
- firstname: String,
- lastname: String,
- email: String,
- password: String,
- gender: String,
- day: u8,
- month: u8,
- year: u32
+#[derive(Deserialize, Debug)]
+pub struct RegistrationRequet {
+ pub firstname: String,
+ pub lastname: String,
+ pub email: String,
+ pub password: String,
+ pub gender: String,
+ pub day: u8,
+ pub month: u8,
+ pub year: u32
}
impl Check for RegistrationRequet {
@@ -34,7 +34,7 @@ impl Check for RegistrationRequet {
async fn register(cookies: Cookies, Json(body): Json<RegistrationRequet>) -> Response {
- let user = match User::new(body.firstname, body.lastname, body.email, body.password, body.gender, body.day, body.month, body.year) {
+ let user = match User::new(body) {
Ok(user) => user,
Err(err) => return err
};