Also unify user creation and user editing.
MQMF2LBWWPW2SOZKC3O7P4TBJJ3V6RBVQ52OYA4KCGXS7G6SHWQAC AWMM5OGV5EM4ZA3T3SCCU6LMKVJHKI2JANCNA236MD3O7AELE5XAC D44B24QC6NCED6DVUYP2IJJEVBG2JNBKPBRRSLI5UXQTKA23DJQQC 7KF7YZDRRB5VR3GDVRVNAXAZWB6T3FAQ3CXWH7J6KODHT3ODIIYAC XJRJ4J7M6BC433TBLWHHKX7UYYCFX6M7ZQLUEYYTREPCSM6M3RDQC LSZLZHJYGXZTCNH4JUXU7W23MW5PBVM4OBMWRRVNEDROMIBUVQNAC LZVO64YG43JD7YMZSCTZNOBS5ROZA4FMPKJW2YOMHX2V5PTGBVWQC XUKHBDR5HJKYJ7GEWTL4YLQEW2S4ERU2WVQZU3INIJB34B4CTUKAC SZYDW2DG5Z7BR3ICKWDXVUNSMCDSXMYZUB6FQ4W2B2FVZJD6PULQC 2G63HKCHG7S6DGWDOHSDF7PXFPD6H4TRKDKIIFCXXAKET6FCWN2AC JARRBLZDQ2JZWY7IUVPTOT7WJMBPMLFLF2MGLVGOYROAAISYGLSAC CGVKJQPIAS6R6BIJWH32MSEEOWS5SFM7TEBGW26LSAMMZFT273CQC return fail($c, "You did not enter the correct digits from the security image.")unless $c->validate_captcha($c->req->param('captcha'));
error($c, "You did not enter the correct digits from the security image.")unless isAdmin($c) || $c->validate_captcha($c->req->param('captcha'));
return fail($c, "Your user name is invalid. It must start with a lower-case letter followed by lower-case letters, digits, dots or underscores.")
error($c, "Your user name is invalid. It must start with a lower-case letter followed by lower-case letters, digits, dots or underscores.")
my $password = trim($c->req->params->{password} // "");if ($user->type eq "hydra" && ($user->password eq "!" || $password ne "")) {error($c, "You must specify a password of at least 6 characters.")unless isValidPassword($password);error($c, "The passwords you specified did not match.")if $password ne trim $c->req->params->{password2};setPassword($user, $password);}my $fullName = trim($c->req->params->{fullname} // "");error($c, "Your must specify your full name.") if $fullName eq "";my $emailAddress = trim($c->req->params->{emailaddress} // "");# FIXME: validate email address?$user->update({ fullname => $fullName, emailonerror => $c->stash->{params}->{"emailonerror"} ? 1 : 0});if (isAdmin($c)) {$user->update({ emailaddress => $emailAddress })if $user->type eq "hydra";$user->userroles->delete;$user->userroles->create({ role => $_ })foreach paramToList($c, "roles");}}
error($c, "Your must specify your full name.") if $fullName eq "";$user->update({ fullname => $fullName, emailonerror => $c->stash->{params}->{"emailonerror"} ? 1 : 0});my $password = $c->stash->{params}->{password} // "";if ($user->type eq "hydra" && $password ne "") {error($c, "You must specify a password of at least 6 characters.")unless isValidPassword($password);error($c, "The passwords you specified did not match.")if $password ne trim $c->stash->{params}->{password2};setPassword($user, $password);}if (isAdmin($c)) {$user->userroles->delete;$user->userroles->create({ role => $_})foreach paramToList($c, "roles");}
updatePreferences($c, $user);
<input type="text" class="span3" name="emailaddress" [% HTML.attributes(value => user.emailaddress) %]/>
<input type="text" class="span3" name="emailaddress" [% IF !create && user.type == 'persona' %]disabled="disabled"[% END %] [%+ HTML.attributes(value => user.emailaddress) %]/>
[% IF !create %]<div class="control-group"><div class="controls"><label class="checkbox"><input type="checkbox" name="emailonerror" [% IF emailonerror; 'checked="checked"'; END %]/>Receive evaluation error notifications</label></div>
<div class="control-group"><div class="controls"><label class="checkbox"><input type="checkbox" name="emailonerror" [% IF emailonerror; 'checked="checked"'; END %]/>Receive evaluation error notifications</label>