diff --git a/auth.php b/auth.php index 2b1f7bc..f898a35 100644 --- a/auth.php +++ b/auth.php @@ -403,7 +403,6 @@ public function loginpage_hook() { $content = str_replace(array("\n", "\r"), array("\\\n", "\\\r"), auth_googleoauth2_display_buttons(false)); $PAGE->requires->css('/auth/googleoauth2/bower_components/font-awesome/css/font-awesome.css'); - // $PAGE->requires->css('/auth/googleoauth2/bower_components/bootstrap-social/bootstrap-social.css'); $PAGE->requires->css('/auth/googleoauth2/style.css'); $PAGE->requires->js_init_code("buttonsCodeOauth2 = '$content';"); $PAGE->requires->js(new moodle_url($CFG->wwwroot . "/auth/googleoauth2/script.js")); diff --git a/lib.php b/lib.php index 8691b40..e7d00a5 100644 --- a/lib.php +++ b/lib.php @@ -35,7 +35,7 @@ function googleoauth2_html_button($authurl, $providerdisplaystyle, $provider) { } else if ($fontawesome == 'battlenet') { $fontawesome = 'trophy'; } - return '' + return '' . get_string('auth_sign-in_with', 'auth_googleoauth2', array('providername' => $provider->readablename)) . ''; } @@ -157,10 +157,12 @@ function auth_googleoauth2_render_buttons() { set_state_token($providername, $provider->state); // Check if we should display the button. - $providerisenabled = $provider->isenabled(); - $providerscount = $providerisenabled ? $providerscount + 1 : $providerscount; - $displayprovider = ((empty($authprovider) || $authprovider == $providername || $allauthproviders) && $providerisenabled); - $providerdisplaystyle = $displayprovider ? 'display:inline-block;padding:10px;' : 'display:none;'; + $displayprovider = $provider->isenabled(); + $providerscount = $displayprovider ? $providerscount + 1 : $providerscount; + if ($displayprovider) { + $displayprovider = (empty($authprovider) || ($authprovider == $providername) || $allauthproviders); + } + $providerdisplaystyle = $displayprovider ? 'display:inline-block;' : 'display:none;'; // The button html code. $html .= $provider->html_button($authurl, $providerdisplaystyle);