Try to fallback to a default login template if the configured one won't work. Fixes bug #11450.

This commit is contained in:
Colin Kuskie 2010-03-02 08:51:13 -08:00
parent beb1337373
commit 119d5137e2
4 changed files with 56 additions and 4 deletions

View file

@ -5,6 +5,7 @@
- fixed #11401: Remove hacks in Asset::Wobject::Weather - fixed #11401: Remove hacks in Asset::Wobject::Weather
- fixed #11449: List of macros in my config file has HASH(0x45223ab3) entry - fixed #11449: List of macros in my config file has HASH(0x45223ab3) entry
- fixed #11443: no language switch in rich edit - fixed #11443: no language switch in rich edit
- fixed #11450: How to lock yourself out of your WebGUI site...
7.8.13 7.8.13
- fixed #11418: confusing typ-o in gotcha - fixed #11418: confusing typ-o in gotcha

View file

@ -571,7 +571,8 @@ sub displayLogin {
$vars->{'anonymousRegistration.isAllowed'} = ($self->session->setting->get("anonymousRegistration")); $vars->{'anonymousRegistration.isAllowed'} = ($self->session->setting->get("anonymousRegistration"));
$vars->{'createAccount.url'} = $self->session->url->page('op=auth;method=createAccount'); $vars->{'createAccount.url'} = $self->session->url->page('op=auth;method=createAccount');
$vars->{'createAccount.label'} = $i18n->get(67); $vars->{'createAccount.label'} = $i18n->get(67);
return WebGUI::Asset::Template->new($self->session,$self->getLoginTemplateId)->process($vars); my $template = $self->getLoginTemplate;
return $template->process($vars);
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -661,6 +662,18 @@ sub getCreateAccountTemplateId {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 getDefaultLoginTemplateId ( )
This method should be overridden by the subclass and should return the default template ID for the login screen.
=cut
sub getDefaultLoginTemplateId {
return "PBtmpl0000000000000013";
}
#-------------------------------------------------------------------
=head2 getExtrasStyle ( ) =head2 getExtrasStyle ( )
This method returns the proper field to display for required fields. This method returns the proper field to display for required fields.
@ -682,6 +695,27 @@ sub getExtrasStyle {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 getLoginTemplate ( )
Returns a WebGUI::Asset::Template object for the login template. If the configured
template cannot be used, then it returns a default template object.
=cut
sub getLoginTemplate {
my $self = shift;
my $session = $self->session;
my $templateId = $self->getLoginTemplateId;
my $template = WebGUI::Asset::Template->newByDynamicClass($session, $templateId);
if (!$template) {
$templateId = $self->getDefaultLoginTemplateId;
$template = WebGUI::Asset::Template->newByDynamicClass($session, $templateId);
}
return $template;
}
#-------------------------------------------------------------------
=head2 getLoginTemplateId ( ) =head2 getLoginTemplateId ( )
This method should be overridden by the subclass and should return the template ID for the login screen. This method should be overridden by the subclass and should return the template ID for the login screen.

View file

@ -605,6 +605,18 @@ sub getCreateAccountTemplateId {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 getDefaultLoginTemplateId ( )
Get the default template ID for the login form.
=cut
sub getDefaultLoginTemplateId {
return "PBtmpl0000000000000006";
}
#-------------------------------------------------------------------
=head2 getLDAPConnection ( ) =head2 getLDAPConnection ( )
Get the properties of the LDAP connection we're using for Auth. Get the properties of the LDAP connection we're using for Auth.
@ -643,8 +655,8 @@ Get the template ID for the login form.
sub getLoginTemplateId { sub getLoginTemplateId {
my $self = shift; my $self = shift;
my $ldapConnect = $self->getLDAPConnection; my $ldapConnect = $self->getLDAPConnection;
return "PBtmpl0000000000000006" unless $ldapConnect; return $self->getDefaultLoginTemplateId unless $ldapConnect;
return ($self->getLDAPConnection->{ldapLoginTemplate} || "PBtmpl0000000000000006"); return ($self->getLDAPConnection->{ldapLoginTemplate} || $self->getDefaultLoginTemplateId);
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -679,6 +679,11 @@ sub getCreateAccountTemplateId {
return $self->session->setting->get("webguiCreateAccountTemplate") || "PBtmpl0000000000000011"; return $self->session->setting->get("webguiCreateAccountTemplate") || "PBtmpl0000000000000011";
} }
#-------------------------------------------------------------------
sub getDefaultLoginTemplateId {
return "PBtmpl0000000000000013";
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub getExpiredPasswordTemplateId { sub getExpiredPasswordTemplateId {
my $self = shift; my $self = shift;
@ -688,7 +693,7 @@ sub getExpiredPasswordTemplateId {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub getLoginTemplateId { sub getLoginTemplateId {
my $self = shift; my $self = shift;
return $self->session->setting->get("webguiLoginTemplate") || "PBtmpl0000000000000013"; return $self->session->setting->get("webguiLoginTemplate") || $self->getDefaultLoginTemplateId;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------