Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX re-label forgot password for uniq id #11568

Open
wants to merge 1 commit into
base: 6
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion 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,8 +25,15 @@ class LostPasswordForm extends MemberLoginForm
*/
public function getFormFields()
{
$uniqueIdentifier = Member::config()->get('unique_identifier_field');
if ($uniqueIdentifier === 'Email') {
$emailField = EmailField::create('Email', _t('SilverStripe\\Security\\Member.EMAIL', 'Email'));
} else {
// This field needs to still be called Email, but we can re-label it
$emailField = TextField::create('Email', _t('SilverStripe\\Security\\Member.LOSTPASSWORDLABEL', $uniqueIdentifier));
}
Comment on lines +28 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth getting a member singleton and calling $singleton->fieldLabel($uniqueIdentifier) to get the field label. Then we don't need any branching logic at all.

return FieldList::create(
EmailField::create('Email', _t('SilverStripe\\Security\\Member.EMAIL', 'Email'))
$emailField
);
Comment on lines 35 to 37
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May as well consolidate this into a single line now

Suggested change
return FieldList::create(
EmailField::create('Email', _t('SilverStripe\\Security\\Member.EMAIL', 'Email'))
$emailField
);
return FieldList::create($emailField);

}

Expand Down
Loading