mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT #4903 MemberLoginForm field for "You are logged in as %s" message customisation (thanks walec51!) (from r111891)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112941 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
b40544e694
commit
ef8419f11d
@ -6,6 +6,12 @@
|
|||||||
*/
|
*/
|
||||||
class MemberLoginForm extends LoginForm {
|
class MemberLoginForm extends LoginForm {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This field is used in the "You are logged in as %s" message
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $loggedInAsField = 'FirstName';
|
||||||
|
|
||||||
protected $authenticator_class = 'MemberAuthenticator';
|
protected $authenticator_class = 'MemberAuthenticator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,9 +107,8 @@ JS
|
|||||||
*/
|
*/
|
||||||
protected function getMessageFromSession() {
|
protected function getMessageFromSession() {
|
||||||
parent::getMessageFromSession();
|
parent::getMessageFromSession();
|
||||||
if(($member = Member::currentUser()) &&
|
if(($member = Member::currentUser()) && !Session::get('MemberLoginForm.force_message')) {
|
||||||
!Session::get('MemberLoginForm.force_message')) {
|
$this->message = sprintf(_t('Member.LOGGEDINAS', "You're logged in as %s."), $member->{$this->loggedInAsField});
|
||||||
$this->message = sprintf(_t('Member.LOGGEDINAS', "You're logged in as %s."), $member->FirstName);
|
|
||||||
}
|
}
|
||||||
Session::set('MemberLoginForm.force_message', false);
|
Session::set('MemberLoginForm.force_message', false);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user