╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────╮ │31 pub const NotFound = @import("./ui/NotFound.zig"); │ │32 pub const NewRepo = @import("./ui/NewRepo.zig"); │ │33 pub const NewUser = @import("./ui/NewUser.zig"); │ │34 -pub const UserLogout = @import("./ui/UserLogout.zig"); │ │34 +pub const UserSettings = @import("./ui/UserSettings.zig");│ │35 pub const UserLogin = @import("./ui/UserLogin.zig"); │ │36 pub const widget = @import("./ui/widget.zig"); │ │37 pub const Widget = widget.Widget; │ ╰──────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────╮ │2219 email_taken, │ │2220 required_password, │ │2221 password_mismatch, │ │2222 + wrong_password, │ │2223 │ │2224 pub fn fromError(err: anyerror) ?UserFailure {│ │2225 return switch (err) { │ ╰────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────╮ │2230 error.EmailTaken => .email_taken, │ │2231 error.PasswordEmpty => .required_password, │ │2232 error.PasswordMismatch => .password_mismatch,│ │2233 + error.WrongPassword => .wrong_password, │ │2234 else => null, │ │2235 }; │ │2236 } │ ╰───────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────╮ │2247 name: []const u8, │ │2248 email: []const u8, │ │2249 }, │ │2250 + }, │ │2251 + user_settings: struct { │ │2252 + failure: UserFailure, │ │2253 + // passwords are never retained │ │2254 + fields: struct { email: []const u8 },│ │2255 }, │ │2256 repo: struct { │ │2257 failure: RepoFailure, │ ╰───────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │2307 // serializable data sent down to web client │ │2308 pub const Data = struct { │ │2309 user_id: ?[]const u8 = null, │ │2303 - // the logged-in user's name, for the views that show it │ │2310 + // the logged-in user's name and email, for the views that show them│ │2311 user_name: ?[]const u8 = null, │ │2312 + user_email: ?[]const u8 = null, │ │2313 // a failed form retained long enough to render it for correction │ │2314 form_feedback: ?FormFeedback = null, │ │2315 // a transient local event-sync error │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2357 const moment = self.haxy_moment orelse return; │ │2358 const user = (try activeUser(moment, self.arena, user_id)) orelse return self.logOut();│ │2359 self.data.user_name = user.event.name; │ │2360 + self.data.user_email = user.event.email; │ │2361 } │ │2362 │ │2363 // forget the logged-in user, on a logout or once their account is removed │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────╮ │2364 pub fn logOut(self: *Self) void { │ │2365 self.data.user_id = null; │ │2366 self.data.user_name = null; │ │2367 + self.data.user_email = null; │ │2368 } │ │2369 │ │2370 pub fn userId(self: *const Self) ?[evt.event_id_size]u8 {│ ╰───────────────────────────────────────────────────────────────────╯