diff --git a/src/api_data/login_success.rs b/src/api_data/login_success.rs index 7db4834..ec14c61 100644 --- a/src/api_data/login_success.rs +++ b/src/api_data/login_success.rs @@ -11,13 +11,18 @@ struct LoginTokens { #[derive(Serialize, Deserialize)] pub struct LoginSuccess { - success: String, + token: String, + + // TODO : remove tokens: LoginTokens, + success: String, } impl LoginSuccess { pub fn new(token: &str) -> LoginSuccess { LoginSuccess { + token: token.to_string(), + success: "Login successful".to_string(), tokens: LoginTokens { token1: token.to_string(), diff --git a/src/controllers/routes.rs b/src/controllers/routes.rs index b2af591..4a26ee7 100644 --- a/src/controllers/routes.rs +++ b/src/controllers/routes.rs @@ -134,12 +134,12 @@ pub fn get_routes() -> Vec { // Account controller Route::limited_post_without_login("/account/create", Box::new(account_controller::create), LimitPolicy::SUCCESS(10)), Route::limited_post_without_login("/account/login", Box::new(account_controller::login_user), LimitPolicy::FAILURE(10)), - Route::limited_post_without_login("/user/connectUSER", Box::new(account_controller::login_user), LimitPolicy::FAILURE(10)), + Route::limited_post_without_login("/user/connectUSER", Box::new(account_controller::login_user), LimitPolicy::FAILURE(10)), // TODO : remove Route::post("/account/logout", Box::new(account_controller::logout_user)), - Route::post("/user/disconnectUSER", Box::new(account_controller::logout_user)), + Route::post("/user/disconnectUSER", Box::new(account_controller::logout_user)), // TODO : remove Route::post("/account/disconnect_all_devices", Box::new(account_controller::disconnect_all_devices)), Route::post("/account/id", Box::new(account_controller::user_id)), - Route::post("/user/getCurrentUserID", Box::new(account_controller::user_id)), + Route::post("/user/getCurrentUserID", Box::new(account_controller::user_id)), // TODO : remove Route::limited_post_without_login("/account/exists_email", Box::new(account_controller::exists_mail), LimitPolicy::ANY(30)), Route::limited_post_without_login("/account/has_security_questions", Box::new(account_controller::has_security_questions), LimitPolicy::FAILURE(10)), Route::limited_post_without_login("/account/get_security_questions", Box::new(account_controller::get_security_questions), LimitPolicy::FAILURE(10)), diff --git a/src/data/http_request_handler.rs b/src/data/http_request_handler.rs index 1555cfc..3aa2d3f 100644 --- a/src/data/http_request_handler.rs +++ b/src/data/http_request_handler.rs @@ -78,6 +78,7 @@ impl HttpRequestHandler { /// Check API client tokens pub fn check_client_token(&mut self) -> RequestResult { + // TODO : remove fallback let client_name = self.post_string_with_fallback("client", "serviceName")?; let client = self.ok_or_bad_request( @@ -111,7 +112,8 @@ impl HttpRequestHandler { /// Check login token pub fn check_user_token(&mut self) -> Res { - let token = self.post_string("userToken1")?; + // TODO : remove fallback + let token = self.post_string_with_fallback("token", "userToken1")?; // Find user match account_helper::find_user_by_login_token(&token, self.api_client()) {