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