From 63a0b1d8c72c05beb94aaa8569f92cde0035a282 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Tue, 13 Mar 2018 16:39:53 +0000 Subject: [PATCH] Bug #11432, D4Science Gateway user registration: confirmation email is sent upon new user registration via Google or LinkedIn SSO with null git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/branches/portal/google-hook-login/1.2/Google@165024 82a268e6-3cf1-43bd-a215-b396298e98cf --- .settings/org.eclipse.wst.common.component | 2 +- distro/changelog.xml | 3 +++ pom.xml | 2 +- src/main/java/gr/cite/google/GoogleOAuth.java | 4 +++- .../gr/cite/google/util/LoginHookEssentialMethods.java | 6 +++++- src/main/webapp/WEB-INF/liferay-plugin-package.properties | 8 ++++---- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 398d029..ac95469 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -4,7 +4,7 @@ - + uses diff --git a/distro/changelog.xml b/distro/changelog.xml index 0e9dea6..a2b7928 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -8,4 +8,7 @@ Fixed a bug concerning users with no google+ available where the authenticated response did not include given and family names + + Feature #11432, D4Science Gateway user registration: confirmation email is sent upon new user registration via Google or LinkedIn SSO + diff --git a/pom.xml b/pom.xml index 6622903..80a63cf 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ The Google hook allows users to login with their Google credentials to a liferay portal - 1.2.0-SNAPSHOT + 1.3.0-SNAPSHOT scm:svn:http://svn.cite.gr/code-bluebridge/google-hook diff --git a/src/main/java/gr/cite/google/GoogleOAuth.java b/src/main/java/gr/cite/google/GoogleOAuth.java index 53b1741..757e58e 100644 --- a/src/main/java/gr/cite/google/GoogleOAuth.java +++ b/src/main/java/gr/cite/google/GoogleOAuth.java @@ -102,7 +102,9 @@ public class GoogleOAuth extends BaseStrutsAction { session.setAttribute(GoogleConstantVariables.USER_EMAIL_ADDRESS_FOR_SESSION_GOOGLE, user.getEmailAddress()); }else if (canCreateAccount){ - LoginHookEssentialMethods.addUser(session, themeDisplay.getCompanyId(), googleUserInfo); + long groupId = PortalUtil.getScopeGroupId(request); + String portalURL = PortalUtil.getPortalURL(request, true); + LoginHookEssentialMethods.addUser(groupId, portalURL, session, themeDisplay.getCompanyId(), googleUserInfo); user = UserLocalServiceUtil.getUserById(UserLocalServiceUtil.getUserByEmailAddress(themeDisplay.getCompanyId(), googleUserInfo.getEmail()).getUserId()); }else{ try{ diff --git a/src/main/java/gr/cite/google/util/LoginHookEssentialMethods.java b/src/main/java/gr/cite/google/util/LoginHookEssentialMethods.java index 270fcc7..0824538 100644 --- a/src/main/java/gr/cite/google/util/LoginHookEssentialMethods.java +++ b/src/main/java/gr/cite/google/util/LoginHookEssentialMethods.java @@ -29,6 +29,7 @@ import com.liferay.portal.model.User; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.theme.ThemeDisplay; +import com.liferay.portal.util.PortalUtil; import com.liferay.portal.util.PortletKeys; import com.liferay.portlet.PortletURLFactoryUtil; @@ -47,7 +48,7 @@ public class LoginHookEssentialMethods { * @return User * @throws SystemException, PortalException, EmailAddressException */ - public static User addUser(HttpSession session, long companyId, GoogleJson googleJson) throws PortalException, SystemException { + public static User addUser(long groupId, String portalURL, HttpSession session, long companyId, GoogleJson googleJson) throws PortalException, SystemException { User user = null; @@ -87,6 +88,9 @@ public class LoginHookEssentialMethods { boolean sendEmail = true; ServiceContext serviceContext = new ServiceContext(); + serviceContext.setScopeGroupId(groupId); + serviceContext.setPortalURL(portalURL); + serviceContext.setPathMain("/c"); try{ user = UserLocalServiceUtil.addUser(creatorUserId, companyId, diff --git a/src/main/webapp/WEB-INF/liferay-plugin-package.properties b/src/main/webapp/WEB-INF/liferay-plugin-package.properties index 7c1a0d3..9ca09a2 100644 --- a/src/main/webapp/WEB-INF/liferay-plugin-package.properties +++ b/src/main/webapp/WEB-INF/liferay-plugin-package.properties @@ -1,9 +1,9 @@ name=Google module-group-id=liferay -module-incremental-version=1 +module-incremental-version=2 tags= short-description= change-log= -page-url=http://www.liferay.com -author=Liferay, Inc. -licenses=LGPL \ No newline at end of file +page-url=http://www.gcube-system.org +author=M. Nikolopoulos, M. Assante +licenses=EUPS