diff --git a/src/View/Helper/SocialProviderHelper.php b/src/View/Helper/SocialProviderHelper.php
new file mode 100644
index 0000000..df5c52b
--- /dev/null
+++ b/src/View/Helper/SocialProviderHelper.php
@@ -0,0 +1,38 @@
+ '/img/keycloak_logo.png',
+ ];
+
+ public function getIcon($identity)
+ {
+ if (!empty($identity['social_profile'])) {
+ $provider = $identity['social_profile']['provider'];
+ if (!empty($this->providerImageMapping[$provider])) {
+ return $this->genImage($this->providerImageMapping[$provider], h($provider));
+ }
+ }
+ return '';
+ }
+
+ private function genImage($url, $alt)
+ {
+ return $this->Bootstrap->genNode('img', [
+ 'src' => $url,
+ 'class' => ['img-fluid'],
+ 'width' => '16',
+ 'height' => '16',
+ 'alt' => $alt,
+ 'title' => __('Authentication provided by {0}', $alt),
+ ]);
+ }
+}
diff --git a/templates/Users/login.php b/templates/Users/login.php
index fdcbe3a..ed522d9 100644
--- a/templates/Users/login.php
+++ b/templates/Users/login.php
@@ -1,4 +1,6 @@
Html->image('logo-purple.png', ['alt' => 'CakePHP', 'class="form-signin"']);
echo '
';
$template = [
@@ -13,16 +15,31 @@
echo $this->Form->control(__('Submit'), ['type' => 'submit', 'class' => 'btn btn-primary']);
echo $this->Form->end();
echo '
';
- echo $this->Form->postLink(
- 'Login with Keycloak',
- [
- 'prefix' => false,
- 'plugin' => 'ADmad/SocialAuth',
- 'controller' => 'Auth',
- 'action' => 'login',
- 'provider' => 'keycloak',
- '?' => ['redirect' => $this->request->getQuery('redirect')]
- ]
- );
+
+ if (!empty(Configure::read('keycloak'))) {
+ echo '';
+ echo $this->Form->create(null, [
+ 'url' => Cake\Routing\Router::url([
+ 'prefix' => false,
+ 'plugin' => 'ADmad/SocialAuth',
+ 'controller' => 'Auth',
+ 'action' => 'login',
+ 'provider' => 'keycloak',
+ '?' => ['redirect' => $this->request->getQuery('redirect')]
+ ]),
+ ]);
+ echo $this->Bootstrap->button([
+ 'type' => 'submit',
+ 'text' => __('Login with Keycloak'),
+ 'variant' => 'secondary',
+ 'class' => ['d-block', 'w-100'],
+ 'image' => [
+ 'path' => '/img/keycloak_logo.png',
+ 'alt' => 'Keycloak'
+ ]
+ ]);
+ echo $this->Form->end();
+ echo '
';
+ }
?>
diff --git a/templates/element/layouts/header/header-profile.php b/templates/element/layouts/header/header-profile.php
index 1fd7414..4cfd43b 100644
--- a/templates/element/layouts/header/header-profile.php
+++ b/templates/element/layouts/header/header-profile.php
@@ -1,4 +1,5 @@
@@ -6,7 +7,14 @@ use Cake\Routing\Router;