Skip to content

Commit

Permalink
FIX re-label forgot password for uniq id
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewandante committed Jan 22, 2025
1 parent 82f5310 commit 7e5eeb2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Security/MemberAuthenticator/LostPasswordForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use SilverStripe\Forms\EmailField;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\FormAction;
use SilverStripe\Forms\TextField;
use SilverStripe\Security\Member;

/**
* Class LostPasswordForm handles the requests for lost password form generation
Expand All @@ -23,9 +25,15 @@ class LostPasswordForm extends MemberLoginForm
*/
public function getFormFields()
{
return FieldList::create(
EmailField::create('Email', _t('SilverStripe\\Security\\Member.EMAIL', 'Email'))
);
$uniqueIdentifier = Member::config()->get('unique_identifier_field');
$label = Member::singleton()->fieldLabel($uniqueIdentifier);
if ($uniqueIdentifier === 'Email') {
$emailField = EmailField::create('Email', $label);
} else {
// This field needs to still be called Email, but we can re-label it
$emailField = TextField::create('Email', $label);
}
return FieldList::create($emailField);
}

/**
Expand Down

0 comments on commit 7e5eeb2

Please sign in to comment.