diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 395d32877..457957c0a 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -5,6 +5,7 @@ - fixed #11401: Remove hacks in Asset::Wobject::Weather - fixed #11449: List of macros in my config file has HASH(0x45223ab3) entry - fixed #11443: no language switch in rich edit + - fixed #11450: How to lock yourself out of your WebGUI site... 7.8.13 - fixed #11418: confusing typ-o in gotcha diff --git a/lib/WebGUI/Auth.pm b/lib/WebGUI/Auth.pm index 2ef3f1d3d..3a193d8ab 100644 --- a/lib/WebGUI/Auth.pm +++ b/lib/WebGUI/Auth.pm @@ -571,7 +571,8 @@ sub displayLogin { $vars->{'anonymousRegistration.isAllowed'} = ($self->session->setting->get("anonymousRegistration")); $vars->{'createAccount.url'} = $self->session->url->page('op=auth;method=createAccount'); $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 ( ) 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 ( ) This method should be overridden by the subclass and should return the template ID for the login screen. diff --git a/lib/WebGUI/Auth/LDAP.pm b/lib/WebGUI/Auth/LDAP.pm index 3385fce29..f2db85138 100644 --- a/lib/WebGUI/Auth/LDAP.pm +++ b/lib/WebGUI/Auth/LDAP.pm @@ -605,6 +605,18 @@ sub getCreateAccountTemplateId { #------------------------------------------------------------------- +=head2 getDefaultLoginTemplateId ( ) + +Get the default template ID for the login form. + +=cut + +sub getDefaultLoginTemplateId { + return "PBtmpl0000000000000006"; +} + +#------------------------------------------------------------------- + =head2 getLDAPConnection ( ) 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 { my $self = shift; my $ldapConnect = $self->getLDAPConnection; - return "PBtmpl0000000000000006" unless $ldapConnect; - return ($self->getLDAPConnection->{ldapLoginTemplate} || "PBtmpl0000000000000006"); + return $self->getDefaultLoginTemplateId unless $ldapConnect; + return ($self->getLDAPConnection->{ldapLoginTemplate} || $self->getDefaultLoginTemplateId); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Auth/WebGUI.pm b/lib/WebGUI/Auth/WebGUI.pm index 1194ef112..b3631337c 100644 --- a/lib/WebGUI/Auth/WebGUI.pm +++ b/lib/WebGUI/Auth/WebGUI.pm @@ -679,6 +679,11 @@ sub getCreateAccountTemplateId { return $self->session->setting->get("webguiCreateAccountTemplate") || "PBtmpl0000000000000011"; } +#------------------------------------------------------------------- +sub getDefaultLoginTemplateId { + return "PBtmpl0000000000000013"; +} + #------------------------------------------------------------------- sub getExpiredPasswordTemplateId { my $self = shift; @@ -688,7 +693,7 @@ sub getExpiredPasswordTemplateId { #------------------------------------------------------------------- sub getLoginTemplateId { my $self = shift; - return $self->session->setting->get("webguiLoginTemplate") || "PBtmpl0000000000000013"; + return $self->session->setting->get("webguiLoginTemplate") || $self->getDefaultLoginTemplateId; } #-------------------------------------------------------------------