From da10f64d29b0c7f3434fa1fc9ac037d32a7073cc Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 16 Dec 2008 01:40:19 +0000 Subject: [PATCH] Forward port fix for no email address during username/email address password recovery. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Auth/WebGUI.pm | 9 ++++++--- lib/WebGUI/i18n/English/AuthWebGUI.pm | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 147158d25..77b8e6fab 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -13,6 +13,7 @@ - fixed #4136: Shortcut doesn't display all properties in override - fixed #8838: Gallery Cross Publish template is broken - fixed #8898: versioning problem + - fixed #9315: Password Recovery 7.6.6 - fixed #8792: Image Preview gives ERROR in Collateral Manager diff --git a/lib/WebGUI/Auth/WebGUI.pm b/lib/WebGUI/Auth/WebGUI.pm index 5074ca1d3..208a7d14a 100644 --- a/lib/WebGUI/Auth/WebGUI.pm +++ b/lib/WebGUI/Auth/WebGUI.pm @@ -900,7 +900,7 @@ sub profileRecoverPasswordFinish { my $username; if ($self->getSetting('passwordRecoveryRequireUsername')) { $username = $self->session->form->process('authWebGUI.username'); - return $self->recoverPassword($i18n2->get('password recovery no username')) unless defined $username; + return $self->recoverPassword($i18n->get('password recovery no username', 'AuthWebGUI')) unless defined $username; } my @fields = @{WebGUI::ProfileField->getPasswordRecoveryFields($self->session)}; @@ -1011,7 +1011,6 @@ sub emailRecoverPasswordFinish { return $self->displayLogin unless ($self->session->setting->get('webguiPasswordRecovery') ne '') and $self->isVisitor; my $i18n = WebGUI::International->new($self->session); - my $i18n2 = WebGUI::International->new($self->session, 'AuthWebGUI'); my $session = $self->session; my ($form) = $session->quick(qw/form/); my $email = $form->param('email'); @@ -1032,7 +1031,7 @@ sub emailRecoverPasswordFinish { # Make sure the user is Active if ( $user->status ne "Active" ) { - return $self->recoverPassword( $i18n2->get( 'password recovery disabled' ) ); + return $self->recoverPassword( $i18n->get( 'password recovery disabled', 'AuthWebGUI' ) ); } # generate information necessry to proceed @@ -1041,6 +1040,10 @@ sub emailRecoverPasswordFinish { my $userId = $user->userId; #get the user guid $email = $user->profileField('email'); + if ( ! $email ) { + return $self->recoverPassword( $i18n->get( 'no email address', 'AuthWebGUI' ) ); + } + my $authsettings = $self->getParams($userId); $authsettings->{emailRecoverPasswordVerificationNumber} = $recoveryGuid; diff --git a/lib/WebGUI/i18n/English/AuthWebGUI.pm b/lib/WebGUI/i18n/English/AuthWebGUI.pm index 27b9d39ab..82a050b48 100644 --- a/lib/WebGUI/i18n/English/AuthWebGUI.pm +++ b/lib/WebGUI/i18n/English/AuthWebGUI.pm @@ -724,6 +724,13 @@ our $I18N = { lastUpdated => 0, context => q{Error message when a user tries to recover password for a disabled account}, }, + + 'no email address' => { + message => q{There is no email address registered for this account. Password recovery via email is not possible.}, + lastUpdated => 1229391388, + context => q{Error message when a user tries to recover password and they don't have an email address}, + }, + }; 1;