%# Never call a man a fool; borrow from him. <& /Foundry/Elements/Header, Title => 'My Page', Method => 'Post' &>

<& /Foundry/Elements/Tabs, Text => 'Preferences' &>
% if ($Error) { * <% $Error %> % } % $m->print($rv);
<& /Foundry/Elements/Footer &> <%INIT> my $Error; if (my $Email = $ARGS{EmailAddress}) { require Email::Valid; if ( $session{CurrentUser}->Name ne 'root' and !Email::Valid->address( -address => $Email ) ) { delete $ARGS{EmailAddress}; $Error = loc('Invalid email address') . ": $Email"; } elsif ($Email ne $session{CurrentUser}->EmailAddress) { my $user = RT::User->new($session{CurrentUser}); $user->LoadByEmail($Email); if ($user->Id) { delete $ARGS{EmailAddress}; $Error = loc('This email address already exists'); } } } elsif ($ARGS{Name}) { delete $ARGS{EmailAddress}; $Error = loc('Invalid email address'); } my $rv = $m->scomp( '/Work/Preferences/index.html', %ARGS, NoUI => 1 ); if ((defined $Pass1) and ($Pass1 ne '') and ($Pass1 eq $Pass2)) { my $obj = $session{CurrentUser}->UserObj->OriginObj; $obj->SetCustomFieldValue( Password => $Pass1 ) if $obj; } <%ARGS> $Pass1 => '' $Pass2 => ''