Browse Source

= LDV::User->update

master
Alex 'AdUser' Z 10 years ago
parent
commit
7c6c71e22a
  1. 11
      lib/LDV/User.pm

11
lib/LDV/User.pm

@ -66,7 +66,7 @@ sub create {
my $user = $self->req->param('username'); my $user = $self->req->param('username');
my $pass = $self->req->param('password'); my $pass = $self->req->param('password');
my $mail = $self->req->param('mail'); my $mail = $self->req->param('mail');
($user and $pass and $email) ($user and $pass and $mail)
or die("please fill all fields\n"); or die("please fill all fields\n");
($user =~ m|^([a-z0-9_-]){3,64}$|oia) ($user =~ m|^([a-z0-9_-]){3,64}$|oia)
or die("wrong username\n"); or die("wrong username\n");
@ -103,12 +103,13 @@ sub update {
or die("wrong password\n"); or die("wrong password\n");
my %attrs = (); my %attrs = ();
foreach my $key (qw(displayname mail org mobile)) { foreach my $key (qw(displayName mail org mobile)) {
my $value = $self->req->param($key) or next; my $value = $self->req->param(lc($key));
$attrs{$key} = $value; $attrs{$key} = $value;
} }
my $error = $self->app->ldap->update($user, %attrs); my $error = $self->app->ldap->update($user, \%attrs);
die("$error\n") if $error; 1; die("$error\n") if $error;
$self->redirect_to('/user/profile'); 1;
} or do { } or do {
$self->flash({result => "Can't save profile: $@"}); $self->flash({result => "Can't save profile: $@"});
$self->redirect_to('/user/login'); $self->redirect_to('/user/login');

Loading…
Cancel
Save