1 package NDWeb::Controller::Settings;
5 use parent 'Catalyst::Controller';
11 NDWeb::Controller::Settings - Catalyst Controller
26 sub index :Path :Args(0) {
27 my ( $self, $c ) = @_;
29 my @stylesheets = ('Default');
30 my $dir = $c->path_to('root/static/css/black.css')->dir;
31 while (my $file = $dir->next){
32 if(!$file->is_dir && $file->basename =~ m{^(\w+)\.css$}){
36 $c->stash(stylesheets => \@stylesheets);
40 sub changeStylesheet : Local {
41 my ( $self, $c ) = @_;
44 my $query = $dbh->prepare(q{UPDATE users SET css = NULLIF($2,'Default')
47 $query->execute($c->user->id,html_escape $c->req->param('stylesheet'));
49 $c->res->redirect($c->uri_for(''));
53 sub changePassword : Local {
54 my ( $self, $c ) = @_;
57 my $query = $dbh->prepare(q{UPDATE users SET password = MD5($1)
58 WHERE password = MD5($2) AND uid = $3
60 $query->execute($c->req->param('pass'),$c->req->param('oldpass'),$c->user->id);
62 $c->res->redirect($c->uri_for(''));
68 Michael Andreen (harv@ruin.nu)