summaryrefslogtreecommitdiff
path: root/imp.ha
diff options
context:
space:
mode:
authorJulian Hurst <julian.hurst@digdash.com>2025-01-22 16:54:10 +0100
committerJulian Hurst <julian.hurst@digdash.com>2025-01-22 16:54:10 +0100
commitd92eff17ca73ba9e61edd028de46dcbc078097c0 (patch)
treed510bb6dc3b733c68f0609716d3388df11e771f8 /imp.ha
parentebda2bb8ac64c57e253007568ce9791ace6e4eb0 (diff)
downloadimp-d92eff17ca73ba9e61edd028de46dcbc078097c0.tar.gz
Add password confirmation
Diffstat (limited to 'imp.ha')
-rw-r--r--imp.ha5
1 files changed, 5 insertions, 0 deletions
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)?;