comparison util/human/io.lua @ 14119:519c16c2eb21 13.0

util.human.io: Trim any trailing newline from password entry Newlines are invalid in passwords anyway, according to saslprep. Trailing newlines can happen when pasting, e.g. when copying the output of command-line password managers/generators to the clipboard.
author Matthew Wild <mwild1@gmail.com>
date Thu, 02 Apr 2026 20:49:37 +0100
parents 82513890a1d8
children 7008869fcce2 7eb0e47418ab
comparison
equal deleted inserted replaced
14114:8f50e7e43df4 14119:519c16c2eb21
41 else 41 else
42 io.write("\027[00m"); 42 io.write("\027[00m");
43 end 43 end
44 io.write("\n"); 44 io.write("\n");
45 if ok then 45 if ok then
46 return pass; 46 return (pass:gsub("\n$", ""));
47 end 47 end
48 end 48 end
49 49
50 local function show_yesno(prompt) 50 local function show_yesno(prompt)
51 io.write(prompt, " "); 51 io.write(prompt, " ");