File tree 3 files changed +14
-1
lines changed
3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ pub struct App {
56
56
pub passkey_sender : Sender < String > ,
57
57
pub cancel_signal_sender : Sender < ( ) > ,
58
58
pub passkey_input : Input ,
59
+ pub show_password : bool ,
59
60
pub mode : Mode ,
60
61
pub selected_mode : Mode ,
61
62
pub current_mode : Mode ,
@@ -113,6 +114,7 @@ impl App {
113
114
let current_mode = adapter. device . mode . clone ( ) ;
114
115
115
116
let ( passkey_sender, passkey_receiver) = async_channel:: unbounded ( ) ;
117
+ let show_password = false ;
116
118
let ( cancel_signal_sender, cancel_signal_receiver) = async_channel:: unbounded ( ) ;
117
119
118
120
let authentication_required = Arc :: new ( AtomicBool :: new ( false ) ) ;
@@ -153,6 +155,7 @@ impl App {
153
155
passkey_sender,
154
156
cancel_signal_sender,
155
157
passkey_input : Input :: default ( ) ,
158
+ show_password,
156
159
mode,
157
160
selected_mode : Mode :: Station ,
158
161
current_mode,
Original file line number Diff line number Diff line change @@ -60,6 +60,11 @@ pub async fn handle_key_events(
60
60
app. cancel_auth ( ) . await ?;
61
61
app. focused_block = FocusedBlock :: Device ;
62
62
}
63
+
64
+ KeyCode :: Tab => {
65
+ app. show_password = !app. show_password ;
66
+ }
67
+
63
68
_ => {
64
69
app. passkey_input
65
70
. handle_event ( & crossterm:: event:: Event :: Key ( key_event) ) ;
Original file line number Diff line number Diff line change @@ -21,7 +21,12 @@ pub fn render(app: &mut App, frame: &mut Frame) {
21
21
// Auth Popup
22
22
if app. authentication_required . load ( Ordering :: Relaxed ) {
23
23
app. focused_block = FocusedBlock :: AuthKey ;
24
- Auth . render ( frame, app. passkey_input . value ( ) ) ;
24
+ let censored_password = "*" . repeat ( app. passkey_input . value ( ) . len ( ) ) ;
25
+ if !app. show_password {
26
+ Auth . render ( frame, & censored_password) ;
27
+ } else {
28
+ Auth . render ( frame, app. passkey_input . value ( ) ) ;
29
+ }
25
30
}
26
31
27
32
// Access Point Popup
You can’t perform that action at this time.
0 commit comments