diff --git a/code/EmailVerifiedMemberAuthenticator.php b/code/EmailVerifiedMemberAuthenticator.php index fe99c44..10a7b25 100644 --- a/code/EmailVerifiedMemberAuthenticator.php +++ b/code/EmailVerifiedMemberAuthenticator.php @@ -5,9 +5,10 @@ * @author Andre Lohmann * @package EmailVerifiedMember */ -class EmailVerifiedMemberAuthenticator extends MemberAuthenticator { +class EmailVerifiedMemberAuthenticator extends MemberAuthenticator +{ - /** + /** * Method that creates the login form for this authentication method * * @param Controller The parent controller, necessary to create the @@ -15,7 +16,8 @@ class EmailVerifiedMemberAuthenticator extends MemberAuthenticator { * @return Form Returns the login form to use with this authentication * method */ - public static function get_login_form(Controller $controller) { - return Object::create("EmailVerifiedMemberLoginForm", $controller, "LoginForm"); + public static function get_login_form(Controller $controller) + { + return Object::create("EmailVerifiedMemberLoginForm", $controller, "LoginForm"); } -} \ No newline at end of file +} diff --git a/code/EmailVerifiedMemberSiteConfig.php b/code/EmailVerifiedMemberSiteConfig.php index 54701f5..dd1a9e5 100644 --- a/code/EmailVerifiedMemberSiteConfig.php +++ b/code/EmailVerifiedMemberSiteConfig.php @@ -1,42 +1,44 @@ "Boolean" - ); - static $defaults = array( - "Moderate" => "true" - ); +class EmailVerifiedMemberSiteConfig extends DataExtension +{ + public static $db = array( + "Moderate" => "Boolean" + ); + public static $defaults = array( + "Moderate" => "true" + ); - static $has_many = array( - "Moderators" => 'Member' - ); - public function updateCMSFields(FieldList $fields) { - $fields->addFieldToTab('Root.MemberModerators', new CheckboxField("Moderate", _t('EmailVerifiedMember.REQUIREMODERATION', "Require moderation."))); - $config = GridFieldConfig_RelationEditor::create(); - // Set the names and data for our gridfield columns - $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array( - 'FirstName'=> 'First name', - 'Surname' => 'Surname', - 'Email' => 'Email' - )); - $config->removeComponentsByType('GridFieldAddNewButton'); - $config->removeComponentsByType('GridFieldEditButton'); - $config->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields(array('FirstName', 'Surname', 'Email'))->setResultsFormat('$FirstName $Surname $Email'); - // Create a gridfield to hold the student relationship - $headerMenuField = new GridField( - 'Moderators', // Field name - 'Members', // Field title - $this->owner->Moderators(), - $config - ); - + public static $has_many = array( + "Moderators" => 'Member' + ); + + public function updateCMSFields(FieldList $fields) + { + $fields->addFieldToTab('Root.MemberModerators', new CheckboxField("Moderate", _t('EmailVerifiedMember.REQUIREMODERATION', "Require moderation."))); + $config = GridFieldConfig_RelationEditor::create(); + // Set the names and data for our gridfield columns + $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array( + 'FirstName'=> 'First name', + 'Surname' => 'Surname', + 'Email' => 'Email' + )); + $config->removeComponentsByType('GridFieldAddNewButton'); + $config->removeComponentsByType('GridFieldEditButton'); + $config->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields(array('FirstName', 'Surname', 'Email'))->setResultsFormat('$FirstName $Surname $Email'); + // Create a gridfield to hold the student relationship + $headerMenuField = new GridField( + 'Moderators', // Field name + 'Members', // Field title + $this->owner->Moderators(), + $config + ); + // $fields->addFieldToTab('Root.Main', new EmailField("AdminEmail", "Admin email address (from address used for forms etc.)")); - $fields->addFieldToTab('Root.MemberModerators', $headerMenuField); - } -} \ No newline at end of file + $fields->addFieldToTab('Root.MemberModerators', $headerMenuField); + } +} diff --git a/code/EmailVerifiedSecurity.php b/code/EmailVerifiedSecurity.php index 6df3d6a..bd5575a 100644 --- a/code/EmailVerifiedSecurity.php +++ b/code/EmailVerifiedSecurity.php @@ -4,176 +4,181 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -class EmailVerifiedSecurity extends Extension { - - public static $allowed_actions = array('emailsent','verifyemail','verifyEmailSent','validate'); - - /** - * Show the "password sent" page, after a user has requested - * to reset their password. - * - * @param SS_HTTPRequest $request The SS_HTTPRequest for this action. - * @return string Returns the "password sent" page as HTML code. - */ - public function emailsent($request) { - Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js'); - Requirements::javascript(SAPPHIRE_DIR . '/javascript/loader.js'); - Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js'); - Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js'); - Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js'); - - $tmpPage = new Page(); - $tmpPage->Title = _t('Security.LOSTPASSWORDHEADER'); - $tmpPage->URLSegment = 'Security'; - $tmpPage->ID = -1; // Set the page ID to -1 so we dont get the top level pages as its children - $controller = new Page_Controller($tmpPage); - $controller->init(); - - $email = Convert::raw2xml($request->param('ID') . '.' . $request->getExtension()); - - $customisedController = $controller->customise(array( - 'Title' => sprintf(_t('EmailVerifiedMember.EMAILSENTHEADER', "Verify Email link sent to '%s'"), $email), - 'Content' => - "
" . - sprintf(_t('EmailVerifiedMember.EMAILSENTTEXT', "Thank you! A verify email link has been sent to '%s', provided an account exists for this email address."), $email) . - "
", - 'Email' => $email - )); - return $customisedController->renderWith(array('Security_emailsent', 'Security', $this->owner->stat('template_main'), 'ContentController')); - } - - /** - * Show the "verify email" page - * - * @return string Returns the "verify email" page as HTML code. - */ - public function verifyemail() { - Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js'); - Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js'); - Requirements::javascript(SAPPHIRE_DIR . '/javascript/loader.js'); - Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js'); - Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js'); - - $tmpPage = new Page(); - $tmpPage->Title = _t('EmailVerifiedMember.VERIFYEMAIL', 'Verify your email'); - $tmpPage->URLSegment = 'Security'; - $tmpPage->ID = -1; // Set the page ID to -1 so we dont get the top level pages as its children - $controller = new Page_Controller($tmpPage); - $controller->init(); - - $customisedController = $controller->customise(array( - 'Content' => - '' . _t('EmailVerifiedMember.VERIFYBEFORELOGON','You need to verify the link in the email we sent you before you can log on.') . '
' . - '' . _t('EmailVerifiedMember.USEFORMBELOW','Use the form below if you would like us to resend the link.') . '
', - 'Form' => $this->owner->VerifyEmailForm(), - )); - - //Controller::$currentController = $controller; - return $customisedController->renderWith(array('Security_verifyemail', 'Security', $this->owner->stat('template_main'), 'ContentController')); - } - - /** - * Factory method for the lost verify email form - * - * @return Form Returns the lost verify email form - */ - public function VerifyEmailForm() { - return new EmailVerifiedMemberLoginForm( - $this->owner, - 'verifyEmailSent', - new FieldList(new EmailField('Email', _t('Member.EMAIL', 'Email'))), - new FieldList(new FormAction('verifyEmailSent',_t('EmailVerifiedMember.BUTTONSEND', 'Send me the verify email link again'))), - false - ); - } - - /** - * Sent verification email form handler method - * - * This method is called when the user clicks on "Resent verification email" - * - * @param array $data Submitted data - */ - function verifyEmailSent($data = null) { - $member = null; - if ($data) { - $SQL_email = Convert::raw2sql($data->postVar("Email")); - $member = DataObject::get_one('Member', "\"Email\" = '{$SQL_email}'"); - } - if($member) { - $member->generateAutologinTokenAndStoreHash(); - $member->sendemail($member); - Director::redirect('Security/emailsent/' . urlencode($data['Email'])); - } elseif($data['Email']) { - // Avoid information disclosure by displaying the same status, - // regardless wether the email address actually exists - Director::redirect('Security/emailsent/' . urlencode($data['Email'])); - } else { - // Adds error message if nothing is entered into Email field. - $FormInfo = array( - "MemberLoginForm_verifyEmailSent" => array( - "formError" => array( - "message" => "Please enter an email address to have the email verification link resent.", "type" => "bad" - ) - ) - ); - Session::set("FormInfo", array_merge(Session::get("FormInfo"), $FormInfo )); - Director::redirect('Security/verifyemail/'); - } - } - - /** - * Validate the link clicked in email - * - * @param SS_HTTPRequest $request The SS_HTTPRequest for this action. - * @return string Returns the "validated" page as HTML code. - */ - public function validate($request) { - - $tmpPage = new Page(); - $tmpPage->Title = _t('EmailVerifiedMember.VERIFYEMAILHEADER', 'Verification link'); - $tmpPage->URLSegment = 'Security'; - $tmpPage->ID = -1; // Set the page ID to -1 so we dont get the top level pages as its children - $controller = new Page_Controller($tmpPage); - $controller->init(); - - if($request && $member = DataObject::get_one('Member', "\"Email\" = '".Convert::raw2sql($request->param('ID'))."'")){ - if ($member->VerificationString == Convert::raw2sql($request->param('OtherID'))){ - if (!$member->Verified) { - $member->Verified = true; - $member->write(); - $member->sendmoderatoremail(); - } - $config = SiteConfig::current_site_config(); +class EmailVerifiedSecurity extends Extension +{ + + public static $allowed_actions = array('emailsent','verifyemail','verifyEmailSent','validate'); + + /** + * Show the "password sent" page, after a user has requested + * to reset their password. + * + * @param SS_HTTPRequest $request The SS_HTTPRequest for this action. + * @return string Returns the "password sent" page as HTML code. + */ + public function emailsent($request) + { + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js'); + Requirements::javascript(SAPPHIRE_DIR . '/javascript/loader.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js'); + Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js'); + Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js'); + + $tmpPage = new Page(); + $tmpPage->Title = _t('Security.LOSTPASSWORDHEADER'); + $tmpPage->URLSegment = 'Security'; + $tmpPage->ID = -1; // Set the page ID to -1 so we dont get the top level pages as its children + $controller = new Page_Controller($tmpPage); + $controller->init(); + + $email = Convert::raw2xml($request->param('ID') . '.' . $request->getExtension()); + + $customisedController = $controller->customise(array( + 'Title' => sprintf(_t('EmailVerifiedMember.EMAILSENTHEADER', "Verify Email link sent to '%s'"), $email), + 'Content' => + "" . + sprintf(_t('EmailVerifiedMember.EMAILSENTTEXT', "Thank you! A verify email link has been sent to '%s', provided an account exists for this email address."), $email) . + "
", + 'Email' => $email + )); + return $customisedController->renderWith(array('Security_emailsent', 'Security', $this->owner->stat('template_main'), 'ContentController')); + } + + /** + * Show the "verify email" page + * + * @return string Returns the "verify email" page as HTML code. + */ + public function verifyemail() + { + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js'); + Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js'); + Requirements::javascript(SAPPHIRE_DIR . '/javascript/loader.js'); + Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js'); + Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js'); + + $tmpPage = new Page(); + $tmpPage->Title = _t('EmailVerifiedMember.VERIFYEMAIL', 'Verify your email'); + $tmpPage->URLSegment = 'Security'; + $tmpPage->ID = -1; // Set the page ID to -1 so we dont get the top level pages as its children + $controller = new Page_Controller($tmpPage); + $controller->init(); + + $customisedController = $controller->customise(array( + 'Content' => + '' . _t('EmailVerifiedMember.VERIFYBEFORELOGON', 'You need to verify the link in the email we sent you before you can log on.') . '
' . + '' . _t('EmailVerifiedMember.USEFORMBELOW', 'Use the form below if you would like us to resend the link.') . '
', + 'Form' => $this->owner->VerifyEmailForm(), + )); + + //Controller::$currentController = $controller; + return $customisedController->renderWith(array('Security_verifyemail', 'Security', $this->owner->stat('template_main'), 'ContentController')); + } + + /** + * Factory method for the lost verify email form + * + * @return Form Returns the lost verify email form + */ + public function VerifyEmailForm() + { + return new EmailVerifiedMemberLoginForm( + $this->owner, + 'verifyEmailSent', + new FieldList(new EmailField('Email', _t('Member.EMAIL', 'Email'))), + new FieldList(new FormAction('verifyEmailSent', _t('EmailVerifiedMember.BUTTONSEND', 'Send me the verify email link again'))), + false + ); + } + + /** + * Sent verification email form handler method + * + * This method is called when the user clicks on "Resent verification email" + * + * @param array $data Submitted data + */ + public function verifyEmailSent($data = null) + { + $member = null; + if ($data) { + $SQL_email = Convert::raw2sql($data->postVar("Email")); + $member = DataObject::get_one('Member', "\"Email\" = '{$SQL_email}'"); + } + if ($member) { + $member->generateAutologinTokenAndStoreHash(); + $member->sendemail($member); + Director::redirect('Security/emailsent/' . urlencode($data['Email'])); + } elseif ($data['Email']) { + // Avoid information disclosure by displaying the same status, + // regardless wether the email address actually exists + Director::redirect('Security/emailsent/' . urlencode($data['Email'])); + } else { + // Adds error message if nothing is entered into Email field. + $FormInfo = array( + "MemberLoginForm_verifyEmailSent" => array( + "formError" => array( + "message" => "Please enter an email address to have the email verification link resent.", "type" => "bad" + ) + ) + ); + Session::set("FormInfo", array_merge(Session::get("FormInfo"), $FormInfo)); + Director::redirect('Security/verifyemail/'); + } + } + + /** + * Validate the link clicked in email + * + * @param SS_HTTPRequest $request The SS_HTTPRequest for this action. + * @return string Returns the "validated" page as HTML code. + */ + public function validate($request) + { + $tmpPage = new Page(); + $tmpPage->Title = _t('EmailVerifiedMember.VERIFYEMAILHEADER', 'Verification link'); + $tmpPage->URLSegment = 'Security'; + $tmpPage->ID = -1; // Set the page ID to -1 so we dont get the top level pages as its children + $controller = new Page_Controller($tmpPage); + $controller->init(); + + if ($request && $member = DataObject::get_one('Member', "\"Email\" = '".Convert::raw2sql($request->param('ID'))."'")) { + if ($member->VerificationString == Convert::raw2sql($request->param('OtherID'))) { + if (!$member->Verified) { + $member->Verified = true; + $member->write(); + $member->sendmoderatoremail(); + } + $config = SiteConfig::current_site_config(); //Debug::Show($config); - if ($config->Moderate) { - $nextAction = _t('EmailVerifiedMember.NEXTACTIONMODERATE', "You will be able to login after a moderator has approved your account."); - } else { - $nextAction = _t('EmailVerifiedMember.NEXTACTIONLOGIN', "You can now login to the website."); - } - - $customisedController = $controller->customise(array( - 'Title' => _t('EmailVerifiedMember.ACCOUNTVERIFIEDTITLE', "Member account verified"), - 'Content' => - "" . - sprintf(_t('EmailVerifiedMember.EMAILVERIFIED', "Thank you %s! Your email account has been verified." . " " . $nextAction), $member->Name) . - "
" - )); - - - return $customisedController->renderWith(array('Security_validationsuccess', 'Security', $this->owner->stat('template_main'), 'ContentController')); - } - } - - // Verification failed - $customisedController = $controller->customise(array( - 'Title' => _t('EmailVerifiedMember.ACCOUNTVERIFIEDFAILTITLE', "Member email address verification failed"), - 'Content' => - "" . - sprintf(_t('EmailVerifiedMember.ACCOUNTVERIFIEDFAIL', "Member email address verification failed, either unknown email address or invalid verification string. Please ensure you copy and pasted the entire link."), $member->Name) . - "
" - )); - return $customisedController->renderWith(array('Security_validationfail', 'Security', $this->owner->stat('template_main'), 'ContentController')); - } -} \ No newline at end of file + if ($config->Moderate) { + $nextAction = _t('EmailVerifiedMember.NEXTACTIONMODERATE', "You will be able to login after a moderator has approved your account."); + } else { + $nextAction = _t('EmailVerifiedMember.NEXTACTIONLOGIN', "You can now login to the website."); + } + + $customisedController = $controller->customise(array( + 'Title' => _t('EmailVerifiedMember.ACCOUNTVERIFIEDTITLE', "Member account verified"), + 'Content' => + "" . + sprintf(_t('EmailVerifiedMember.EMAILVERIFIED', "Thank you %s! Your email account has been verified." . " " . $nextAction), $member->Name) . + "
" + )); + + + return $customisedController->renderWith(array('Security_validationsuccess', 'Security', $this->owner->stat('template_main'), 'ContentController')); + } + } + + // Verification failed + $customisedController = $controller->customise(array( + 'Title' => _t('EmailVerifiedMember.ACCOUNTVERIFIEDFAILTITLE', "Member email address verification failed"), + 'Content' => + "" . + sprintf(_t('EmailVerifiedMember.ACCOUNTVERIFIEDFAIL', "Member email address verification failed, either unknown email address or invalid verification string. Please ensure you copy and pasted the entire link."), $member->Name) . + "
" + )); + return $customisedController->renderWith(array('Security_validationfail', 'Security', $this->owner->stat('template_main'), 'ContentController')); + } +} diff --git a/code/form/EmailVerifiedMemberLoginForm.php b/code/form/EmailVerifiedMemberLoginForm.php index 6064c70..d87330f 100644 --- a/code/form/EmailVerifiedMemberLoginForm.php +++ b/code/form/EmailVerifiedMemberLoginForm.php @@ -3,104 +3,105 @@ * Log-in form for the "member" authentication method * @package EmailVerifiedMember */ -class EmailVerifiedMemberLoginForm extends MemberLoginForm { +class EmailVerifiedMemberLoginForm extends MemberLoginForm +{ - protected $authenticator_class = 'EmailVerifiedMemberAuthenticator'; + protected $authenticator_class = 'EmailVerifiedMemberAuthenticator'; - /** - * Constructor - * - * @param Controller $controller The parent controller, necessary to - * create the appropriate form action tag. - * @param string $name The method on the controller that will return this - * form object. - * @param FieldList|FormField $fields All of the fields in the form - a - * {@link FieldList} of {@link FormField} - * objects. - * @param FieldList|FormAction $actions All of the action buttons in the - * form - a {@link FieldList} of - * {@link FormAction} objects - * @param bool $checkCurrentUser If set to TRUE, it will be checked if a - * the user is currently logged in, and if - * so, only a logout button will be rendered - * @param string $authenticatorClassName Name of the authenticator class that this form uses. - */ - function __construct($controller, $name, $fields = null, $actions = null, - $checkCurrentUser = true) { + /** + * Constructor + * + * @param Controller $controller The parent controller, necessary to + * create the appropriate form action tag. + * @param string $name The method on the controller that will return this + * form object. + * @param FieldList|FormField $fields All of the fields in the form - a + * {@link FieldList} of {@link FormField} + * objects. + * @param FieldList|FormAction $actions All of the action buttons in the + * form - a {@link FieldList} of + * {@link FormAction} objects + * @param bool $checkCurrentUser If set to TRUE, it will be checked if a + * the user is currently logged in, and if + * so, only a logout button will be rendered + * @param string $authenticatorClassName Name of the authenticator class that this form uses. + */ + public function __construct($controller, $name, $fields = null, $actions = null, + $checkCurrentUser = true) + { - // This is now set on the class directly to make it easier to create subclasses - // $this->authenticator_class = $authenticatorClassName; + // This is now set on the class directly to make it easier to create subclasses + // $this->authenticator_class = $authenticatorClassName; - $customCSS = project() . '/css/member_login.css'; - if(Director::fileExists($customCSS)) { - Requirements::css($customCSS); - } + $customCSS = project() . '/css/member_login.css'; + if (Director::fileExists($customCSS)) { + Requirements::css($customCSS); + } - if(isset($_REQUEST['BackURL'])) { - $_REQUEST['BackURL'] = str_replace("/RegistrationForm", "", $_REQUEST['BackURL']); - $backURL = $_REQUEST['BackURL']; - } else { - if (strpos(Session::get('BackURL'), "/RegistrationForm") > 0) { - Session::set('BackURL', str_replace("/RegistrationForm", "", Session::get('BackURL'))); - } - $backURL = str_replace("/RegistrationForm", "", Session::get('BackURL')); - } + if (isset($_REQUEST['BackURL'])) { + $_REQUEST['BackURL'] = str_replace("/RegistrationForm", "", $_REQUEST['BackURL']); + $backURL = $_REQUEST['BackURL']; + } else { + if (strpos(Session::get('BackURL'), "/RegistrationForm") > 0) { + Session::set('BackURL', str_replace("/RegistrationForm", "", Session::get('BackURL'))); + } + $backURL = str_replace("/RegistrationForm", "", Session::get('BackURL')); + } - if($checkCurrentUser && Member::currentUser() && Member::logged_in_session_exists()) { - $fields = new FieldList( - new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this) - ); - $actions = new FieldList( - new FormAction("logout", _t('Member.BUTTONLOGINOTHER', "Log in as someone else")) - ); - } else { - if(!$fields) { - $label=singleton('Member')->fieldLabel(Member::get_unique_identifier_field()); - $fields = new FieldList( - new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this), - //Regardless of what the unique identifer field is (usually 'Email'), it will be held in the 'Email' value, below: - new TextField("Email", $label, Session::get('SessionForms.MemberLoginForm.Email'), null, $this), - new PasswordField("Password", _t('Member.PASSWORD', 'Password')) - ); - if(Security::$autologin_enabled) { - $fields->push(new CheckboxField( - "Remember", - _t('Member.REMEMBERME', "Remember me next time?") - )); - } - } - if(!$actions) { - $actions = new FieldList( - new FormAction('dologin', _t('Member.BUTTONLOGIN', "Log in")), - new LiteralField( - 'forgotPassword', - '' . _t('Member.BUTTONLOSTPASSWORD', "I've lost my password") . '
' - ), - new LiteralField( - 'resendEmail', - '' . _t('EmailVerifiedMember.BUTTONRESENDEMAIL', "I've lost my verification email") . '
' - ) - ); - } - } + if ($checkCurrentUser && Member::currentUser() && Member::logged_in_session_exists()) { + $fields = new FieldList( + new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this) + ); + $actions = new FieldList( + new FormAction("logout", _t('Member.BUTTONLOGINOTHER', "Log in as someone else")) + ); + } else { + if (!$fields) { + $label=singleton('Member')->fieldLabel(Member::get_unique_identifier_field()); + $fields = new FieldList( + new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this), + //Regardless of what the unique identifer field is (usually 'Email'), it will be held in the 'Email' value, below: + new TextField("Email", $label, Session::get('SessionForms.MemberLoginForm.Email'), null, $this), + new PasswordField("Password", _t('Member.PASSWORD', 'Password')) + ); + if (Security::$autologin_enabled) { + $fields->push(new CheckboxField( + "Remember", + _t('Member.REMEMBERME', "Remember me next time?") + )); + } + } + if (!$actions) { + $actions = new FieldList( + new FormAction('dologin', _t('Member.BUTTONLOGIN', "Log in")), + new LiteralField( + 'forgotPassword', + '' . _t('Member.BUTTONLOSTPASSWORD', "I've lost my password") . '
' + ), + new LiteralField( + 'resendEmail', + '' . _t('EmailVerifiedMember.BUTTONRESENDEMAIL', "I've lost my verification email") . '
' + ) + ); + } + } - if(isset($backURL)) { - $fields->push(new HiddenField('BackURL', 'BackURL', $backURL)); - } + if (isset($backURL)) { + $fields->push(new HiddenField('BackURL', 'BackURL', $backURL)); + } - parent::__construct($controller, $name, $fields, $actions); + parent::__construct($controller, $name, $fields, $actions); - // Focus on the email input when the page is loaded - // Only include this if other form JS validation is enabled + // Focus on the email input when the page is loaded + // Only include this if other form JS validation is enabled /* if($this->getValidator()->getJavascriptValidationHandler() != 'none') { - Requirements::customScript(<<