2 % $cgi->param('error', $error);
3 <% $cgi->redirect(popurl(1). "pref.html?". $cgi->query_string ) %>
5 <% include('/elements/header.html', 'Preferences updated') %>
6 <% include('/elements/footer.html') %>
10 if ( FS::Conf->new->exists('disable_acl_changes') ) {
11 errorpage("Preference changes disabled in public demo");
12 die "shouldn't be reached";
18 if ( grep { $cgi->param($_) !~ /^\s*$/ }
19 qw(_password new_password new_password2)
22 $access_user = qsearchs( 'access_user', {
23 'username' => getotaker,
24 '_password' => scalar($cgi->param('_password')),
27 $error = 'Current password incorrect; password not changed'
30 $error ||= "New passwords don't match"
31 unless $cgi->param('new_password') eq $cgi->param('new_password2');
33 $error ||= "No new password entered"
34 unless length($cgi->param('new_password'));
36 $access_user->_password($cgi->param('new_password')) unless $error;
40 $access_user = $FS::CurrentUser::CurrentUser;
44 #well, if you got your password change wrong, you don't get anything else
45 #changed right now. but it should be sticky on the form
46 unless ( $error ) { # if ($access_user) {
48 my %param = $access_user->options;
51 my @paramlist = qw( locale menu_position default_customer_view
53 spreadsheet_format mobile_menu
55 disable_html_editor disable_enter_submit_onetimecharge
56 enable_mask_clipboard_hack dashboard_customers
60 snom-ip snom-username snom-password
61 vonage-fromnumber vonage-username vonage-password
62 cust_pkg-display_times
63 show_pkgnum show_confitem_counts export_getsettings
64 show_db_profile save_db_profile save_tmp_typesetting
65 height width availHeight availWidth colorDepth
68 foreach (@paramlist) {
69 scalar($cgi->param($_)) =~ /^[,.\-\@\w]*$/ && next;
70 $error ||= "Illegal value for parameter $_";
74 foreach (@paramlist) {
75 $param{$_} = scalar($cgi->param($_));
78 $error ||= $access_user->replace( \%param );
82 if ( !$error and ($FS::TicketSystem::system || '') eq 'RT_Internal' ) {
83 # sync RT user locale on every update
84 my $locale = $access_user->option('locale');
85 FS::TicketSystem->init;
86 my $UserObj = FS::TicketSystem->session('')->{'CurrentUser'}->UserObj;
87 # Bypass RT ModifySelf ACL
88 $UserObj->CurrentUser( $RT::SystemUser );
89 if ( $UserObj->Lang ne $locale ) {
90 my ($val, $msg) = $UserObj->SetLang($locale);
91 $error = $msg if !$val;