From d92eff17ca73ba9e61edd028de46dcbc078097c0 Mon Sep 17 00:00:00 2001 From: Julian Hurst Date: Wed, 22 Jan 2025 16:54:10 +0100 Subject: Add password confirmation --- imp.ha | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/imp.ha b/imp.ha index 2aef8ba..9c57ab8 100644 --- a/imp.ha +++ b/imp.ha @@ -128,6 +128,10 @@ export fn main() void = { const n = getinput("name: ")!; const u = getinput("user: ")!; const p = getinput("pass: ", true)!; + const cp = getinput("confirm pass: ", true)!; + if (p != cp) { + fmt::fatal("Passwords don't match"); + }; if (n == "" || u == "" || p == "") { free(n); free(u); @@ -404,6 +408,7 @@ fn getinput(text: str = "", noecho: bool = false) (str | tty::error | io::error const termios = tty::termios_query(termf)?; tty::noecho(&termios)?; defer tty::termios_restore(&termios); + defer fmt::fprintln(termf)!; return readin(termf)?; }; return readin(termf)?; -- cgit v1.2.3