displaying username and username contained in the jwt now
This commit is contained in:
@@ -22,6 +22,7 @@ pub struct AuthState {
|
||||
pub auth_token: Option<String>,
|
||||
pub user_id: Option<String>,
|
||||
pub role: Option<String>,
|
||||
pub decoded_username: Option<String>,
|
||||
pub has_unsaved_changes: bool,
|
||||
}
|
||||
|
||||
@@ -55,6 +56,7 @@ impl AuthState {
|
||||
user_id: None,
|
||||
role: None,
|
||||
has_unsaved_changes: false,
|
||||
decoded_username: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user