Use secure input so visibility of password can be toggled

This commit is contained in:
Jason Rodney Hansen 2024-08-05 19:52:46 -06:00 committed by Jeremy Soller
parent 501d7b19d0
commit 75e456ed4b

View file

@ -659,15 +659,18 @@ impl cosmic::Application for App {
match &self.prompt_opt { match &self.prompt_opt {
Some((prompt, secret, value_opt)) => match value_opt { Some((prompt, secret, value_opt)) => match value_opt {
Some(value) => { Some(value) => {
let mut text_input = widget::text_input(prompt.clone(), value.clone()) let mut text_input = widget::secure_input(
.leading_icon( prompt.clone(),
widget::icon::from_name("system-lock-screen-symbolic").into(), value.clone(),
) Some(Message::Prompt(
.trailing_icon( prompt.clone(),
widget::icon::from_name("document-properties-symbolic").into(), !*secret,
) Some(value.clone()),
.on_input(|value| Message::Prompt(prompt.clone(), *secret, Some(value))) )),
.on_submit(Message::Submit); *secret,
)
.on_input(|value| Message::Prompt(prompt.clone(), *secret, Some(value)))
.on_submit(Message::Submit);
if let Some(text_input_id) = self.text_input_ids.get(&surface_id) { if let Some(text_input_id) = self.text_input_ids.get(&surface_id) {
text_input = text_input.id(text_input_id.clone()); text_input = text_input.id(text_input_id.clone());