summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2014-10-15 14:48:52 +0200
committerYorhel <git@yorhel.nl>2014-10-15 14:48:58 +0200
commitd67b8e2e277d163cf97df3edc78067f75f87920c (patch)
treeae7a0ffc332bbfd2f45575bc98e7e54d8ce6a233
parent6e0a0e1d00e11da9b4eab2163e19314f752b05b5 (diff)
Multi::API: Fix crash on failed login
I broke this when changing the column type of login_throttle.timeout.
-rw-r--r--lib/Multi/API.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Multi/API.pm b/lib/Multi/API.pm
index 52ac683a..03d55098 100644
--- a/lib/Multi/API.pm
+++ b/lib/Multi/API.pm
@@ -458,9 +458,9 @@ sub login_res { # num, res, [ c, arg, tm ]
if(lc($encrypted) ne lc($res->[0]{passwd})) {
$tm += $VNDB::S{login_throttle}[0];
- $_[KERNEL]->post(pg => do => 'UPDATE login_throttle SET timeout = ? WHERE ip = ?', [ $tm, $c->{ip} ]);
+ $_[KERNEL]->post(pg => do => 'UPDATE login_throttle SET timeout = to_timestamp(?) WHERE ip = ?', [ $tm, $c->{ip} ]);
$_[KERNEL]->post(pg => do =>
- 'INSERT INTO login_throttle (ip, timeout) SELECT ?, ? WHERE NOT EXISTS(SELECT 1 FROM login_throttle WHERE ip = ?)',
+ 'INSERT INTO login_throttle (ip, timeout) SELECT ?, to_timestamp(?) WHERE NOT EXISTS(SELECT 1 FROM login_throttle WHERE ip = ?)',
[ $c->{ip}, $tm, $c->{ip} ]);
return cerr $c, auth => "Wrong password for user '$arg->{username}'";
}