diff options
| author | Julian Hurst <julian.hurst@digdash.com> | 2025-01-22 16:54:10 +0100 |
|---|---|---|
| committer | Julian Hurst <julian.hurst@digdash.com> | 2025-01-22 16:54:10 +0100 |
| commit | d92eff17ca73ba9e61edd028de46dcbc078097c0 (patch) | |
| tree | d510bb6dc3b733c68f0609716d3388df11e771f8 /imp.ha | |
| parent | ebda2bb8ac64c57e253007568ce9791ace6e4eb0 (diff) | |
| download | imp-d92eff17ca73ba9e61edd028de46dcbc078097c0.tar.gz | |
Add password confirmation
Diffstat (limited to 'imp.ha')
| -rw-r--r-- | imp.ha | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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)?; |
