3 # Make all the changes, and re-direct to / in case the theme has changed
7 require './change-user-lib.pl';
8 our (%text, %in, %gconfig, $base_remote_user, %access);
11 my @users = &acl::list_users();
12 my ($user) = grep { $_->{'name'} eq $base_remote_user } @users;
13 my $oldtheme = $user->{'theme'};
14 my $oldoverlay = $user->{'overlay'};
15 if (!defined($oldtheme)) {
16 ($oldtheme, $oldoverlay) = split(/\s+/, $gconfig{'theme'});
19 # Validate the password
20 if ($access{'pass'} && &can_change_pass($user) && !$in{'pass_def'}) {
21 $in{'pass'} =~ /:/ && &error($text{'change_ecolon'});
22 $in{'pass'} eq $in{'pass2'} ||
23 &error($text{'change_epass2'});
24 my $perr = &acl::check_password_restrictions(
25 $user->{'name'}, $in{'pass'});
26 &error(&text('change_epass', $perr)) if ($perr);
29 # Parse custom language
30 if ($access{'lang'}) {
31 if ($in{'lang_def'}) {
32 $user->{'lang'} = undef;
35 $user->{'lang'} = $in{'lang'};
39 # Parse custom theme and possibly overlay
40 my ($newoverlay, $newtheme);
41 if ($access{'theme'}) {
42 if ($in{'theme_def'}) {
43 $user->{'theme'} = undef;
46 $user->{'theme'} = $in{'theme'};
48 $newtheme = $user->{'theme'};
49 if (!defined($newtheme)) {
50 $newtheme = $gconfig{'theme'};
54 if (!$in{'overlay'}) {
56 $user->{'overlay'} = undef;
59 $newoverlay = $in{'overlay'};
60 $user->{'theme'} || &error($text{'change_eoverlay'});
61 my %oinfo = &get_theme_info($in{'overlay'});
62 if ($oinfo{'overlays'} &&
63 &indexof($user->{'theme'},
64 split(/\s+/, $oinfo{'overlays'})) < 0) {
65 &error($text{'change_eoverlay2'});
67 $user->{'overlay'} = $in{'overlay'};
71 # Parse password change
72 if ($access{'pass'} && &can_change_pass($user) && !$in{'pass_def'}) {
73 $user->{'pass'} = &acl::encrypt_password($in{'pass'});
74 $user->{'temppass'} = 0;
77 &ui_print_unbuffered_header(undef, $text{'change_title'}, "");
79 print "$text{'change_user'}<br>\n";
80 &acl::modify_user($user->{'name'}, $user);
81 print "$text{'change_done'}<p>\n";
83 print "$text{'change_restart'}<br>\n";
85 print "$text{'change_done'}<p>\n";
87 if ($access{'theme'} &&
88 ($newtheme ne $oldtheme || $newoverlay ne $oldoverlay)) {
89 print "$text{'change_redirect'}<br>\n";
90 print &js_redirect("/", "top");
91 print "$text{'change_done'}<p>\n";
94 &ui_print_footer("/", $text{'index'});