produce valid HTML in the Auth screen

This commit is contained in:
Colin Kuskie 2008-08-01 03:00:04 +00:00
parent 63fe276dac
commit e3b9e4bd92
5 changed files with 24 additions and 24 deletions

View file

@ -14,6 +14,7 @@
- fixed: adding payment brings me to / - fixed: adding payment brings me to /
- fixed: Gallery uses too much disk space. Added a way to change an images pixel density. - fixed: Gallery uses too much disk space. Added a way to change an images pixel density.
- fixed: splitCSV and joinCSV had issues with complex CSV data - fixed: splitCSV and joinCSV had issues with complex CSV data
- fixed: Anonymous registration form produces invalid html
7.5.18 7.5.18
- fixed: Collateral Image Manager broken in Firefox 3 - fixed: Collateral Image Manager broken in Firefox 3

View file

@ -63,7 +63,7 @@ sub _isDuplicateUsername {
my ($otherUser) = $self->session->db->quickArray("select count(*) from users where username=".$self->session->db->quote($username)); my ($otherUser) = $self->session->db->quickArray("select count(*) from users where username=".$self->session->db->quote($username));
return 0 if !$otherUser; return 0 if !$otherUser;
my $i18n = WebGUI::International->new($self->session); my $i18n = WebGUI::International->new($self->session);
$self->error(sprintf($i18n->get(77), $username,$username,$username,$self->session->datetime->epochToHuman($self->session->datetime->time(),"%y"))); $self->error('<li>'.sprintf($i18n->get(77), $username,$username,$username,$self->session->datetime->epochToHuman($self->session->datetime->time(),"%y")).'</li>');
return 1; return 1;
} }

View file

@ -48,7 +48,7 @@ sub _isValidLDAPUser {
$username = $self->session->form->get("authLDAP_ldapId") || $self->session->form->get("username"); $username = $self->session->form->get("authLDAP_ldapId") || $self->session->form->get("username");
$password = $self->session->form->get("authLDAP_identifier") || $self->session->form->get("identifier"); $password = $self->session->form->get("authLDAP_identifier") || $self->session->form->get("identifier");
$uri = URI->new($connection->{ldapUrl}) or $error = $i18n->get(2,'AuthLDAP'); $uri = URI->new($connection->{ldapUrl}) or $error = '<li>'.$i18n->get(2,'AuthLDAP').'</li>';
if($error ne ""){ if($error ne ""){
$self->error($error); $self->error($error);
@ -110,12 +110,12 @@ sub _isValidLDAPUser {
} }
} }
else { # Unable to bind with proxy user credentials or anonymously for our search else { # Unable to bind with proxy user credentials or anonymously for our search
$error = $i18n->get(2,'AuthLDAP'); $error = '<li>'.$i18n->get(2,'AuthLDAP').'</li>';
$self->session->errorHandler->error("Couldn't bind to LDAP server: ".$connection->{ldapUrl}); $self->session->errorHandler->error("Couldn't bind to LDAP server: ".$connection->{ldapUrl});
} }
} }
else { # Could not create our LDAP object else { # Could not create our LDAP object
$error = $i18n->get(2,'AuthLDAP'); $error = '<li>'.$i18n->get(2,'AuthLDAP').'</li>';
$self->session->errorHandler->error("Couldn't create LDAP object: ".$uri->host); $self->session->errorHandler->error("Couldn't create LDAP object: ".$uri->host);
} }
@ -150,8 +150,8 @@ sub authenticate {
my $identifier = $_[1]; my $identifier = $_[1];
my $userData = $self->getParams; my $userData = $self->getParams;
$error .= $i18n->get(12,'AuthLDAP') if ($userData->{ldapUrl} eq ""); $error .= '<li>'.$i18n->get(12,'AuthLDAP').'</li>' if ($userData->{ldapUrl} eq "");
$error .= $i18n->get(11,'AuthLDAP') if ($userData->{connectDN} eq ""); $error .= '<li>'.$i18n->get(11,'AuthLDAP').'</li>' if ($userData->{connectDN} eq "");
$self->error($error); $self->error($error);
if($error ne ""){ if($error ne ""){
@ -162,7 +162,7 @@ sub authenticate {
if($uri = URI->new($userData->{ldapUrl})) { if($uri = URI->new($userData->{ldapUrl})) {
# Create an LDAP object # Create an LDAP object
$ldap = Net::LDAP->new($uri->host, (port=>$uri->port)) or $error .= $i18n->get(2,'AuthLDAP'); $ldap = Net::LDAP->new($uri->host, (port=>$uri->port)) or $error .= '<li>'.$i18n->get(2,'AuthLDAP').'</li>';
if($error ne ""){ if($error ne ""){
$self->user(WebGUI::User->new($self->session,1)); $self->user(WebGUI::User->new($self->session,1));
@ -174,17 +174,17 @@ sub authenticate {
# Authentication failed # Authentication failed
if ($auth->code == 48 || $auth->code == 49){ if ($auth->code == 48 || $auth->code == 49){
$error .= $i18n->get(68); $error .= '<li>'.$i18n->get(68).'</li>';
} }
elsif ($auth->code > 0) { # Some other LDAP error happened elsif ($auth->code > 0) { # Some other LDAP error happened
$error .= 'LDAP error "'.$self->ldapStatusCode($auth->code).'" occured.'.$i18n->get(69); $error .= '<li>LDAP error "'.$self->ldapStatusCode($auth->code).'" occured.'.$i18n->get(69).'</li>';
$self->session->errorHandler->error("LDAP error: ".$self->ldapStatusCode($auth->code)); $self->session->errorHandler->error("LDAP error: ".$self->ldapStatusCode($auth->code));
} }
$ldap->unbind; $ldap->unbind;
} }
else { else {
$error .= $i18n->get(13,'AuthLDAP'); $error .= '<li>'.$i18n->get(13,'AuthLDAP').'</li>';
$self->session->errorHandler->error("Could not process this LDAP URL: ".$userData->{ldapUrl}); $self->session->errorHandler->error("Could not process this LDAP URL: ".$userData->{ldapUrl});
} }
@ -291,7 +291,7 @@ sub createAccountSave {
#Validate profile data. #Validate profile data.
my ($profile, $temp, $warning) = WebGUI::Operation::Profile::validateProfileData($self->session); my ($profile, $temp, $warning) = WebGUI::Operation::Profile::validateProfileData($self->session);
$error .= $temp; $error .= $temp;
return $self->createAccount("<h1>".$i18n->get(70)."</h1>".$error) unless ($error eq ""); return $self->createAccount("<li>".$error."</li1>") unless ($error eq "");
#If Email address is not unique, a warning is displayed #If Email address is not unique, a warning is displayed
if($warning ne "" && !$self->session->form->process("confirm")){ if($warning ne "" && !$self->session->form->process("confirm")){
return $self->createAccount('<li>'.$i18n->get(1078).'</li>', 1); return $self->createAccount('<li>'.$i18n->get(1078).'</li>', 1);

View file

@ -124,7 +124,7 @@ sub authenticate {
} }
$self->user(WebGUI::User->new($self->session,1)); $self->user(WebGUI::User->new($self->session,1));
my $i18n = WebGUI::International->new($self->session); my $i18n = WebGUI::International->new($self->session);
$self->error($i18n->get(68)); $self->error('<li>'.$i18n->get(68).'</li>');
return 0; return 0;
} }
@ -143,7 +143,7 @@ sub createAccount {
return $self->displayLogin; return $self->displayLogin;
} }
my $i18n = WebGUI::International->new($self->session); my $i18n = WebGUI::International->new($self->session);
$vars->{'create.message'} = $message if ($message); $vars->{'create.message'} = '<ul>'.$message.'</ul>' if ($message);
$vars->{useCaptcha} = $self->session->setting->get("webguiUseCaptcha"); $vars->{useCaptcha} = $self->session->setting->get("webguiUseCaptcha");
if ($vars->{useCaptcha}) { if ($vars->{useCaptcha}) {
use WebGUI::Form::Captcha; use WebGUI::Form::Captcha;
@ -204,7 +204,7 @@ sub createAccountSave {
$error = $self->error unless($self->validUsername($username)); $error = $self->error unless($self->validUsername($username));
if ($setting->get("webguiUseCaptcha")) { if ($setting->get("webguiUseCaptcha")) {
unless ($form->process('authWebGUI.captcha', "Captcha")) { unless ($form->process('authWebGUI.captcha', "Captcha")) {
$error .= $i18n->get("captcha failure","AuthWebGUI"); $error .= '<li>'.$i18n->get("captcha failure","AuthWebGUI").'</li>';
} }
} }
$error .= $self->error unless($self->_isValidPassword($password,$passConfirm)); $error .= $self->error unless($self->_isValidPassword($password,$passConfirm));
@ -317,11 +317,11 @@ sub displayLogin {
my $self = shift; my $self = shift;
my $vars; my $vars;
return $self->displayAccount($_[0]) if ($self->userId ne "1"); return $self->displayAccount($_[0]) if ($self->userId ne "1");
my $i18n = WebGUI::International->new($self->session); my $i18n = WebGUI::International->new($self->session);
$vars->{'login.message'} = $_[0] if ($_[0]); $vars->{'login.message'} = '<ul>'.$_[0].'</ul>' if ($_[0]);
$vars->{'recoverPassword.isAllowed'} = $self->getSetting("passwordRecovery"); $vars->{'recoverPassword.isAllowed'} = $self->getSetting("passwordRecovery");
$vars->{'recoverPassword.url'} = $self->session->url->page('op=auth;method=recoverPassword'); $vars->{'recoverPassword.url'} = $self->session->url->page('op=auth;method=recoverPassword');
$vars->{'recoverPassword.label'} = $i18n->get(59); $vars->{'recoverPassword.label'} = $i18n->get(59);
return $self->SUPER::displayLogin("login",$vars); return $self->SUPER::displayLogin("login",$vars);
} }
@ -1127,7 +1127,7 @@ sub resetExpiredPasswordSave {
$error .= '<li>'.$i18n->get(12,'AuthWebGUI').'</li>' if ($self->session->form->process("oldPassword") eq $self->session->form->process("identifier")); $error .= '<li>'.$i18n->get(12,'AuthWebGUI').'</li>' if ($self->session->form->process("oldPassword") eq $self->session->form->process("identifier"));
$error .= $self->error if(!$self->_isValidPassword($self->session->form->process("identifier"),$self->session->form->process("identifierConfirm"))); $error .= $self->error if(!$self->_isValidPassword($self->session->form->process("identifier"),$self->session->form->process("identifierConfirm")));
return $self->resetExpiredPassword($u->userId, "<h1>".$i18n->get(70)."</h1>".$error) if($error ne ""); return $self->resetExpiredPassword($u->userId, "<h1>".$i18n->get(70)."</h1><ul>".$error.'</ul>') if ($error);
$properties->{identifier} = Digest::MD5::md5_base64($self->session->form->process("identifier")); $properties->{identifier} = Digest::MD5::md5_base64($self->session->form->process("identifier"));
$properties->{passwordLastUpdated} =$self->session->datetime->time(); $properties->{passwordLastUpdated} =$self->session->datetime->time();
@ -1165,7 +1165,7 @@ sub updateAccount {
my $username = $self->session->form->process('authWebGUI.username'); my $username = $self->session->form->process('authWebGUI.username');
my $password = $self->session->form->process('authWebGUI.identifier'); my $password = $self->session->form->process('authWebGUI.identifier');
my $passConfirm = $self->session->form->process('authWebGUI.identifierConfirm'); my $passConfirm = $self->session->form->process('authWebGUI.identifierConfirm');
my $display = '<li>'.$i18n->get(81).'</li>'; my $display = '<ul><li>'.$i18n->get(81).'</li></ul>';
my $error = ""; my $error = "";
if($self->userId eq '1'){ if($self->userId eq '1'){

View file

@ -605,12 +605,11 @@ our $I18N = {
}, },
'77' => { '77' => {
message => q|<li>That account name is already in use by another member of this site. Please try a different username. The following are some suggestions:<br /> message => q|That account name is already in use by another member of this site. Please try a different username. The following are some suggestions:<br />
%sToo<br /> %sToo<br />
%s2<br /> %s2<br />
%s_%d<br /> %s_%d<br />|,
</li>|, lastUpdated => 1217216725
lastUpdated => 1140292461
}, },
'444' => { '444' => {