mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-21 11:44:55 +00:00
Make authentication fail count configurable
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
# The number of failed authentications before a special animation is played... ;)
|
||||||
|
auth_fails = 10
|
||||||
|
|
||||||
# The active animation
|
# The active animation
|
||||||
# none -> Nothing (default)
|
# none -> Nothing (default)
|
||||||
# doom -> PSX DOOM fire
|
# doom -> PSX DOOM fire
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const Animation = enums.Animation;
|
|||||||
const Input = enums.Input;
|
const Input = enums.Input;
|
||||||
const ViMode = enums.ViMode;
|
const ViMode = enums.ViMode;
|
||||||
|
|
||||||
|
auth_fails: u64 = 10,
|
||||||
animation: Animation = .none,
|
animation: Animation = .none,
|
||||||
asterisk: ?u8 = '*',
|
asterisk: ?u8 = '*',
|
||||||
bg: u16 = 0,
|
bg: u16 = 0,
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ pub fn main() !void {
|
|||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
// If the user entered a wrong password 10 times in a row, play a cascade animation, else update normally
|
// If the user entered a wrong password 10 times in a row, play a cascade animation, else update normally
|
||||||
if (auth_fails < 10) {
|
if (auth_fails < config.auth_fails) {
|
||||||
_ = termbox.tb_clear();
|
_ = termbox.tb_clear();
|
||||||
|
|
||||||
if (!animation_timed_out) {
|
if (!animation_timed_out) {
|
||||||
@@ -561,7 +561,7 @@ pub fn main() !void {
|
|||||||
_ = interop.system_time.gettimeofday(&tv, null);
|
_ = interop.system_time.gettimeofday(&tv, null);
|
||||||
|
|
||||||
timeout = @intCast((60 - @rem(tv.tv_sec, 60)) * 1000 - @divTrunc(tv.tv_usec, 1000) + 1);
|
timeout = @intCast((60 - @rem(tv.tv_sec, 60)) * 1000 - @divTrunc(tv.tv_usec, 1000) + 1);
|
||||||
} else if (config.clock != null or auth_fails >= 10) {
|
} else if (config.clock != null or auth_fails >= config.auth_fails) {
|
||||||
var tv: interop.system_time.timeval = undefined;
|
var tv: interop.system_time.timeval = undefined;
|
||||||
_ = interop.system_time.gettimeofday(&tv, null);
|
_ = interop.system_time.gettimeofday(&tv, null);
|
||||||
|
|
||||||
@@ -709,7 +709,7 @@ pub fn main() !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try std.posix.tcsetattr(std.posix.STDIN_FILENO, .FLUSH, tb_termios);
|
try std.posix.tcsetattr(std.posix.STDIN_FILENO, .FLUSH, tb_termios);
|
||||||
if (auth_fails < 10) {
|
if (auth_fails < config.auth_fails) {
|
||||||
_ = termbox.tb_clear();
|
_ = termbox.tb_clear();
|
||||||
_ = termbox.tb_present();
|
_ = termbox.tb_present();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user