diff options
author | Yorhel <git@yorhel.nl> | 2008-11-09 23:11:05 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2008-11-09 23:11:05 +0100 |
commit | 4cdeba70968acf9f3bdb19323c87a4e6ea0476cf (patch) | |
tree | 8a2db7f7673bc3d0954bf00cbe14e93750f2f4f5 /lib/VNDB/DB/Users.pm | |
parent | fd63b8135a8d451dc1dea26792555a92d76e01d3 (diff) |
Password-reset-form now works
I'm staring with all the simple user-management stuff, as you may
have noticed.
Diffstat (limited to 'lib/VNDB/DB/Users.pm')
-rw-r--r-- | lib/VNDB/DB/Users.pm | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/VNDB/DB/Users.pm b/lib/VNDB/DB/Users.pm index 8fb9814f..48b00266 100644 --- a/lib/VNDB/DB/Users.pm +++ b/lib/VNDB/DB/Users.pm @@ -5,10 +5,10 @@ use strict; use warnings; use Exporter 'import'; -our @EXPORT = 'dbUserGet'; +our @EXPORT = qw|dbUserGet dbUserEdit|; -# %options->{ username passwd order uid results page } +# %options->{ username passwd mail order uid results page } sub dbUserGet { my $s = shift; my %o = ( @@ -24,6 +24,8 @@ sub dbUserGet { 'username = ?' => $o{username} ) : (), $o{passwd} ? ( 'passwd = decode(?, \'hex\')' => $o{passwd} ) : (), + $o{mail} ? ( + 'mail = ?' => $o{mail} ) : (), $o{uid} ? ( 'id = ?' => $o{uid} ) : (), !$o{uid} && !$o{username} ? ( @@ -43,4 +45,22 @@ sub dbUserGet { } +# uid, %options->{ columns in users table } +sub dbUserEdit { + my($s, $uid, %o) = @_; + + my %h; + defined $o{$_} && ($h{$_.' = ?'} = $o{$_}) + for (qw| username mail rank flags |); + $h{'passwd = decode(?, \'hex\')'} = $o{passwd} + if defined $o{passwd}; + + return if scalar keys %h <= 0; + return $s->dbExec(q| + UPDATE users + !H + WHERE id = ?|, + \%h, $uid); +} + 1; |