diff --git a/client/src/state/pages/auth.rs b/client/src/state/pages/auth.rs index 416b89c..fa6714b 100644 --- a/client/src/state/pages/auth.rs +++ b/client/src/state/pages/auth.rs @@ -22,6 +22,7 @@ pub struct AuthState { pub auth_token: Option, pub user_id: Option, pub role: Option, + pub decoded_username: Option, pub has_unsaved_changes: bool, } @@ -55,6 +56,7 @@ impl AuthState { user_id: None, role: None, has_unsaved_changes: false, + decoded_username: None, } } } diff --git a/client/src/tui/functions/common/login.rs b/client/src/tui/functions/common/login.rs index 6bcea8d..53df246 100644 --- a/client/src/tui/functions/common/login.rs +++ b/client/src/tui/functions/common/login.rs @@ -28,15 +28,18 @@ pub async fn save( auth_state.auth_token = Some(response.access_token.clone()); auth_state.user_id = Some(response.user_id.clone()); auth_state.role = Some(response.role.clone()); + auth_state.decoded_username = Some(response.username.clone()); auth_state.set_has_unsaved_changes(false); let success_message = format!( "Login Successful!\n\n\ + Username: {}\n\ Access Token: {}\n\ Token Type: {}\n\ Expires In: {}\n\ User ID: {}\n\ Role: {}", + response.username, response.access_token, response.token_type, response.expires_in, @@ -44,9 +47,6 @@ pub async fn save( response.role ); - // Use the helper method to configure and show the dialog - // TODO Implement logic for pressing menu or exit buttons, not imeplementing it now, - // need to do other more important stuff now" app_state.show_dialog( "Login Success", &success_message, diff --git a/common/proto/auth.proto b/common/proto/auth.proto index 9c5221e..de9f8bd 100644 --- a/common/proto/auth.proto +++ b/common/proto/auth.proto @@ -35,4 +35,5 @@ message LoginResponse { int32 expires_in = 3; // Expiration in seconds (86400 for 24 hours) string user_id = 4; // User's UUID in string format string role = 5; // User's role + string username = 6; } diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index 56166bc..47c106e 100644 Binary files a/common/src/proto/descriptor.bin and b/common/src/proto/descriptor.bin differ diff --git a/common/src/proto/multieko2.auth.rs b/common/src/proto/multieko2.auth.rs index 22bd8ff..16f7e74 100644 --- a/common/src/proto/multieko2.auth.rs +++ b/common/src/proto/multieko2.auth.rs @@ -52,6 +52,8 @@ pub struct LoginResponse { /// User's role #[prost(string, tag = "5")] pub role: ::prost::alloc::string::String, + #[prost(string, tag = "6")] + pub username: ::prost::alloc::string::String, } /// Generated client implementations. pub mod auth_service_client {