[tmp page_title][L]Change Email[/L][/tmp] [tmpn members_only]1[/tmpn] [tmp display_class]noleft[/tmp] @_TOP_@

# [scratch page_title]

[edisplay show_var=0 show_label=1 keep=1] [wdisplay] [set check_email] [calc] $Values->{ok_to_change_email} = ''; [/calc] email=required &fatal=yes email=email email=match email_verify Emails must match. email=unique userdb::usernick Sorry, that email is already associated with an account. &set=ok_to_change_email 1 [/set]
[L]Current email[/L]: [value email] [form-session-id]
[error name=email std_label="[L]Change your email to[/L]"]:
[error name=email_verify std_label="[L]Type it again[/L]"]:
[set change_email] [perl tables=userdb] my $udb = $Db{userdb}; return unless $Values->{ok_to_change_email}; if(! $Session->{logged_in}) { $Tag->error({ name => 'change_username', set => 'Not logged in' }); return; } my $email = $CGI->{email} or return; $email = lc($email); $email =~ s/^\s+//; $email =~ s/\s+$//; my ($log, $die, $warn) = $Tag->logger('change_email', 'logs/member.log'); my $result = $udb->set_slice($Session->{username}, ['usernick','email'], [ $email, $email ]); #$Tag->userdb('logout'); $log->("Username $Session->{username} changed email to $email."); return $Tag->warnings(errmsg("Changed email to %s.", $email)) if $result; return $Tag->error({ name => 'change_email', set => 'Failure -- please contact us.' }); [/perl] [/set] [tmp clear_errors][error all=1 comment="Clear errors"][/tmp]
@_BOTTOM_@