Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 56 additions & 2 deletions src/login/login_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,55 @@ script_mod! {
confirm_password_wrapper := View {
width: 275, height: Fit,
visible: false,
flow: Overlay,

confirm_password_input := RobrixTextInput {
width: 275, height: Fit
width: Fill, height: Fit
flow: Right, // do not wrap
padding: 10,
padding: Inset{top: 10, bottom: 10, left: 10, right: 40}
empty_text: "Confirm password"
is_password: true,
}

View {
width: Fill, height: Fill
align: Align{x: 1.0, y: 0.5}

show_confirm_password_button := Button {
width: 36, height: 36,
padding: 6,
draw_bg +: {
color: #0000
color_hover: #0000
color_down: #0000
border_size: 0.0
}
draw_icon +: {
svg: (mod.widgets.ICON_EYE_CLOSED),
color: #8C8C8C,
}
icon_walk: Walk{width: 20, height: 20}
text: ""
}

hide_confirm_password_button := Button {
visible: false,
width: 36, height: 36,
padding: 6,
draw_bg +: {
color: #0000
color_hover: #0000
color_down: #0000
border_size: 0.0
}
draw_icon +: {
svg: (mod.widgets.ICON_EYE_OPEN),
color: #8C8C8C,
}
icon_walk: Walk{width: 20, height: 20}
text: ""
}
}
}

View {
Expand Down Expand Up @@ -587,6 +628,8 @@ pub struct LoginScreen {
#[rust] signup_mode: bool,
/// Whether the password field is currently showing plaintext.
#[rust] password_visible: bool,
/// Whether the confirm password field is currently showing plaintext.
#[rust] confirm_password_visible: bool,
/// Boolean to indicate if the SSO login process is still in flight
#[rust] sso_pending: bool,
/// The URL to redirect to after logging in with SSO.
Expand Down Expand Up @@ -963,6 +1006,17 @@ impl WidgetMatchEvent for LoginScreen {
self.redraw(cx);
}

// Handle toggling confirm password visibility
let show_confirm_pw_button = self.view.button(cx, ids!(show_confirm_password_button));
let hide_confirm_pw_button = self.view.button(cx, ids!(hide_confirm_password_button));
if show_confirm_pw_button.clicked(actions) || hide_confirm_pw_button.clicked(actions) {
self.confirm_password_visible = !self.confirm_password_visible;
confirm_password_input.toggle_is_password(cx);
show_confirm_pw_button.set_visible(cx, !self.confirm_password_visible);
hide_confirm_pw_button.set_visible(cx, self.confirm_password_visible);
self.redraw(cx);
}

if mode_toggle_button.clicked(actions) {
self.set_signup_mode(cx, !self.signup_mode);
}
Expand Down
Loading