╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Login.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
250 .wrong_password => { 251 self.session.data.login_failure = .wrong_password; 252 return; 253 }, 254 .success => |user_id| { 255 // dupe user_id into the arena so the session can hold a stable slice 256 const user_id_stable = try self.session.arena.allocator().dupe(u8, &user_id); 257 self.session.data.user_id = user_id_stable; 258 self.session.data.login_failure = null; 259 260 // adopt the user's persisted prefs 261 try self.session.loadUserPrefs(); 262 263 // wipe the entered credentials so they don't linger if the 264 // user returns to this page after logging out 265 username_input.clear(allocator); 266 password_input.clear(allocator); 267 268 // jump focus back to the users tab — the login button we 269 // just pressed is about to be hidden by the tab-label swap 270 try root_focus.setFocus(self.success_redirect_tab_id); 271 }, 272 } 273 } 274 }; 275