summaryrefslogtreecommitdiff
path: root/lib/RHRD/rddb.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/RHRD/rddb.pm')
-rwxr-xr-xlib/RHRD/rddb.pm34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm
index 63a182c..ee49444 100755
--- a/lib/RHRD/rddb.pm
+++ b/lib/RHRD/rddb.pm
@@ -72,6 +72,20 @@ sub get_token
return ($token, 'OK', 'success');
}
+sub set_token
+{
+ my ($dbh, $username, $token) = @_;
+
+ my $sql = qq{update USERS set PASSWORD = ? where LOGIN_NAME = ?;};
+ my $rows = $dbh->do($sql, undef, $token, $username)
+ or return (undef, 'ERROR', "Database Error: " . $dbh->errstr);
+
+ unless($rows == 1) {
+ return (undef, 'ERROR', "user '" . $username . "' not known by rivendell")
+ }
+ return ($token, 'OK', 'success');
+}
+
sub check_token
{
my ($dbh, $username, $token) = @_;
@@ -96,6 +110,26 @@ sub check_token
return (0, 'ERROR', "wrong password");
}
+sub get_users
+{
+ my ($dbh) = @_;
+
+ my $sql = qq{select LOGIN_NAME from USERS order by LOGIN_NAME;};
+ my $sth = $dbh->prepare($sql)
+ or return (undef, 'ERROR', "Database Error: " . $dbh->errstr);
+
+ $sth->execute()
+ or return (undef, 'ERROR', "Database Error: " . $sth->errstr);
+
+ my @users;
+ while(my ($user) = $sth->fetchrow_array()) {
+ push @users, $user;
+ }
+ $sth->finish();
+
+ return @users;
+}
+
sub get_showtitle_and_log
{
my ($dbh, $showid) = @_;