change social buttons

This commit is contained in:
PEDSF 2020-12-16 18:23:57 +01:00
parent f5c0430bbb
commit 824bd0d209
2 changed files with 11 additions and 7 deletions

View file

@ -159,7 +159,7 @@ public class UserController extends WebSocketSender {
String firstName; String firstName;
String lastName; String lastName;
String email; String email;
String providerId; String providerId = "";
String provider = authentication.getAuthorizedClientRegistrationId(); String provider = authentication.getAuthorizedClientRegistrationId();
if (provider.equals(CommonAttribute.GOOGLE)) { if (provider.equals(CommonAttribute.GOOGLE)) {
@ -170,10 +170,14 @@ public class UserController extends WebSocketSender {
else { else {
firstName = authentication.getPrincipal().getAttribute(CommonAttribute.GITHUB_FIRSTNAME); firstName = authentication.getPrincipal().getAttribute(CommonAttribute.GITHUB_FIRSTNAME);
lastName = authentication.getPrincipal().getAttribute(CommonAttribute.GITHUB_LASTNAME); lastName = authentication.getPrincipal().getAttribute(CommonAttribute.GITHUB_LASTNAME);
providerId = String.valueOf(authentication.getPrincipal().getAttribute(CommonAttribute.GITHUB_PROVIDER_ID)); try {
providerId = authentication.getPrincipal().getAttribute(CommonAttribute.GITHUB_PROVIDER_ID).toString();
} catch (NullPointerException exception) {
log.error("Cast integer to string ",exception);
}
} }
email = authentication.getPrincipal().getAttribute("email"); email = authentication.getPrincipal().getAttribute(CommonAttribute.EMAIL);
CredentialDTO credential = credentialService.findByAuthentication(authentication); CredentialDTO credential = credentialService.findByAuthentication(authentication);

View file

@ -30,14 +30,14 @@
<h2 style="text-align:center">Login with Social Media</h2> <h2 style="text-align:center">Login with Social Media</h2>
<div class="col-md-12 " th:each="url : ${urls}" style="text-align:center"> <div class="col-md-12 " th:each="url : ${urls}" style="text-align:center; margin-bottom: 10px">
<a th:if="${url.key == 'Google'}" th:href="${url.value}" class="btn btn-bloc btn-social btn-lg" style="background-color: #dd4b39"> <a th:if="${url.key == 'Google'}" th:href="${url.value}" class="btn btn-bloc btn-social btn-lg" style="width:250px; background-color: #dd4b39">
<i class="fa fa-google fa-fw"></i> Login with Google <i class="fa fa-google fa-fw"></i> Login with Google
</a> </a>
<a th:if="${url.key == 'GitHub'}" th:href="${url.value}" class="btn btn-bloc btn-social btn-lg" style="background-color: black"> <a th:if="${url.key == 'GitHub'}" th:href="${url.value}" class="btn btn-bloc btn-social btn-lg" style="width:250px; background-color: black">
<i class="fa fa-github fa-fw"></i> Login with Github <i class="fa fa-github fa-fw"></i> Login with Github
</a> </a>
<a th:if="${url.key == 'Facebook'}" th:href="${url.value}" class="btn btn-bloc btn-social btn-lg" style="background-color: #3B5998"> <a th:if="${url.key == 'Facebook'}" th:href="${url.value}" class="btn btn-bloc btn-social btn-lg" style="width:250px; background-color: #3B5998">
<i class="fa fa-facebook fa-fw"></i> Login with Facebook <i class="fa fa-facebook fa-fw"></i> Login with Facebook
</a> </a>