2 % $cgi->param('error', $error);
3 <% $cgi->redirect(popurl(1). "pref.html?". $cgi->query_string ) %>
5 <% $cgi->redirect( -uri => popurl(1). "pref.html",
6 -cookie => CGI::Cookie->new(
7 -name => 'freeside_status',
8 -value => mt('Preferences updated'),
16 my $access_user = $FS::CurrentUser::CurrentUser;
18 if ( FS::Conf->new->exists('disable_acl_changes') ) {
19 errorpage("Preference changes disabled in public demo");
20 die "shouldn't be reached";
25 if ( FS::Auth->auth_class->can('change_password')
26 && grep { $cgi->param($_) !~ /^\s*$/ }
27 qw(_password new_password new_password2)
30 my $oldpass = $cgi->param('_password');
31 my $newpass = $cgi->param('new_password');
33 if ( $newpass ne $cgi->param('new_password2') ) {
34 $error = mt("New passwords don't match");
36 } elsif ( ! length($newpass) ) {
37 $error = mt('No new password entered');
39 } elsif ( ! FS::Auth->authenticate( $access_user, $oldpass ) ) {
40 $error = mt('Current password incorrect; password not changed');
44 $error = $access_user->is_password_allowed($newpass)
45 || $access_user->change_password($newpass);
51 #well, if you got your password change wrong, you don't get anything else
52 #changed right now. but it should be sticky on the form
53 unless ( $error ) { # if ($access_user) {
55 my %param = $access_user->options;
58 my @paramlist = qw( locale menu_position default_customer_view
60 spreadsheet_format mobile_menu
61 disable_html_editor disable_enter_submit_onetimecharge
62 enable_mask_clipboard_hack dashboard_customers
66 snom-ip snom-username snom-password
67 vonage-fromnumber vonage-username vonage-password
68 cust_pkg-display_times
69 show_pkgnum show_confitem_counts export_getsettings
70 show_db_profile save_db_profile save_tmp_typesetting
71 height width availHeight availWidth colorDepth
74 foreach (@paramlist) {
75 scalar($cgi->param($_)) =~ /^[,.\-\@\w]*$/ && next;
76 $error ||= mt("Illegal value for parameter")." $_";
80 foreach (@paramlist) {
81 $param{$_} = scalar($cgi->param($_));
84 $error ||= $access_user->replace( \%param );
88 if ( !$error and ($FS::TicketSystem::system || '') eq 'RT_Internal' ) {
89 # sync RT user locale on every update
90 my $locale = $access_user->option('locale');
91 FS::TicketSystem->init;
92 my $UserObj = FS::TicketSystem->session('')->{'CurrentUser'}->UserObj;
93 # Bypass RT ModifySelf ACL
94 $UserObj->CurrentUser( $RT::SystemUser );
95 if ( $UserObj->Lang ne $locale ) {
96 my ($val, $msg) = $UserObj->SetLang($locale);
97 $error = $msg if !$val;