auth dialog implemented

This commit is contained in:
filipriec
2025-03-30 20:38:09 +02:00
parent f6e21b6a61
commit e19b30f4f4
6 changed files with 165 additions and 6 deletions

View File

@@ -19,10 +19,13 @@ pub async fn handle_action(
} else if auth_state.current_field == 0 {
// Username -> Password (wrap around fields only)
auth_state.current_field = 1;
} else if auth_state.current_field == 2 {
// From Login button to Password field
auth_state.current_field = 1;
}
// Update cursor position only when in a field
if !auth_state.return_selected {
if auth_state.current_field < 2 {
let current_input = auth_state.get_current_input();
let max_cursor_pos = current_input.len();
auth_state.current_cursor_pos = (*ideal_cursor_column).min(max_cursor_pos);
@@ -40,12 +43,15 @@ pub async fn handle_action(
auth_state.current_field = 1;
} else if auth_state.current_field == 1 {
// Password -> Login button
auth_state.current_field = 2;
auth_state.return_selected = false;
// No cursor update needed when on buttons
} else if auth_state.current_field == 2 {
// Login button -> Return button
auth_state.return_selected = true;
}
// Update cursor position only when in a field
if !auth_state.return_selected {
if auth_state.current_field < 2 {
let current_input = auth_state.get_current_input();
let max_cursor_pos = current_input.len();
auth_state.current_cursor_pos = (*ideal_cursor_column).min(max_cursor_pos);