Skip to content

Commit

Permalink
Removed permissions getter for config
Browse files Browse the repository at this point in the history
  • Loading branch information
wilr committed Jan 16, 2019
1 parent 28087d0 commit 4e014ca
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions code/forms/FacebookLoginForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,35 @@
*/
class FacebookLoginForm extends MemberLoginForm
{

protected $authenticator_class = 'FacebookAuthenticator';

public function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true)
{
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 {
$permissions = Config::inst()->get(
'FacebookControllerExtension', 'permissions'
);

$fields = new FieldList(
new LiteralField('FacebookLoginIn', "<fb:login-button scope='". $controller->getFacebookPermissions() ."'></fb:login-button>")
new LiteralField('FacebookLoginIn', "<fb:login-button scope='". implode(',', $permissions) ."'></fb:login-button>")
);

$actions = new FieldList(
new LiteralField('FacebookLoginLink', "<!-- <a href='".$controller->getFacebookLoginLink() ."'>". _t('FacebookLoginForm.LOGIN', 'Login') ."</a> -->")
);
}

$backURL = (isset($_REQUEST['BackURL'])) ? $_REQUEST['BackURL'] : Session::get('BackURL');

if (isset($backURL)) {
$fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
}
Expand Down

0 comments on commit 4e014ca

Please sign in to comment.