summaryrefslogtreecommitdiff
path: root/lib/VNDB/Util/Auth.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-12-23 11:48:09 +0100
committerYorhel <git@yorhel.nl>2010-12-23 11:48:09 +0100
commite0131b6ab501eaeda1003ac5131f803a36192d46 (patch)
treef18682fd8e087264e73631bcd12b662627e631ca /lib/VNDB/Util/Auth.pm
parentaca465c568a4fba065d04fdb236309a9fcb1c37c (diff)
Added users_prefs table and removed users.(skin|customcss)
Will convert the other preferences later.
Diffstat (limited to 'lib/VNDB/Util/Auth.pm')
-rw-r--r--lib/VNDB/Util/Auth.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm
index 24e316ce..50b81eb2 100644
--- a/lib/VNDB/Util/Auth.pm
+++ b/lib/VNDB/Util/Auth.pm
@@ -14,7 +14,7 @@ use YAWF ':html';
use VNDB::Func;
-our @EXPORT = qw| authInit authLogin authLogout authInfo authCan authPreparePass authGetCode authCheckCode |;
+our @EXPORT = qw| authInit authLogin authLogout authInfo authCan authPreparePass authGetCode authCheckCode authPref |;
# initializes authentication information and checks the vndb_auth cookie
@@ -27,7 +27,7 @@ sub authInit {
return _rmcookie($self) if length($cookie) < 41;
my $token = substr($cookie, 0, 40);
my $uid = substr($cookie, 40);
- $self->{_auth} = $uid =~ /^\d+$/ && $self->dbUserGet(uid => $uid, session => $token, what => 'extended notifycount')->[0];
+ $self->{_auth} = $uid =~ /^\d+$/ && $self->dbUserGet(uid => $uid, session => $token, what => 'extended notifycount prefs')->[0];
# update the sessions.lastused column if lastused < now()'6 hours'
$self->dbSessionUpdateLastUsed($uid, $token) if $self->{_auth} && $self->{_auth}{session_lastused} < time()-6*3600;
return _rmcookie($self) if !$self->{_auth};
@@ -196,5 +196,13 @@ sub _incorrectcode {
}
+sub authPref {
+ my($self, $key, $val) = @_;
+ return '' if !$self->authInfo->{id};
+ return $self->{_auth}{prefs}{$key}||'' if @_ == 2;
+ $self->{_auth}{prefs}{$key} = $val;
+ $self->dbUserPrefSet($key, $val);
+}
+
1;