mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-20 19:24:53 +00:00
Add option to allow empty password or not (closes #577)
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -6,6 +6,7 @@ const Input = enums.Input;
|
||||
const ViMode = enums.ViMode;
|
||||
const Bigclock = enums.Bigclock;
|
||||
|
||||
allow_empty_password: bool = true,
|
||||
animation: Animation = .none,
|
||||
animation_timeout_sec: u12 = 0,
|
||||
asterisk: ?u32 = '*',
|
||||
|
||||
@@ -15,6 +15,7 @@ err_config: []const u8 = "unable to parse config file",
|
||||
err_console_dev: []const u8 = "failed to access console",
|
||||
err_dgn_oob: []const u8 = "log message",
|
||||
err_domain: []const u8 = "invalid domain",
|
||||
err_empty_password: []const u8 = "empty password not allowed",
|
||||
err_envlist: []const u8 = "failed to get envlist",
|
||||
err_hostname: []const u8 = "failed to get hostname",
|
||||
err_mlock: []const u8 = "failed to lock password memory",
|
||||
|
||||
12
src/main.zig
12
src/main.zig
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user