Add option to allow empty password or not (closes #577)

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion
2025-03-06 22:00:46 +01:00
parent 6504cd0209
commit 92845268af
21 changed files with 33 additions and 1 deletions

View File

@@ -686,7 +686,17 @@ pub fn main() !void {
update = true;
},
termbox.TB_KEY_ENTER => {
termbox.TB_KEY_ENTER => authenticate: {
if (!config.allow_empty_password and password.text.items.len == 0) {
try info_line.addMessage(lang.err_empty_password, config.error_bg, config.error_fg);
InfoLine.clearRendered(allocator, buffer) catch {
try info_line.addMessage(lang.err_alloc, config.error_bg, config.error_fg);
};
info_line.label.draw();
_ = termbox.tb_present();
break :authenticate;
}
try info_line.addMessage(lang.authenticating, config.bg, config.fg);
InfoLine.clearRendered(allocator, buffer) catch {
try info_line.addMessage(lang.err_alloc, config.error_bg, config.error_fg);