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
This commit is contained in:
Massimiliano Assante 2018-03-13 16:39:53 +00:00
parent c71d7d4f43
commit 63a0b1d8c7
6 changed files with 17 additions and 8 deletions

View File

@ -4,7 +4,7 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="checkAdditionalEmails-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/checkAdditionalEmails/checkAdditionalEmails">
<dependent-module archiveName="landing-page-library-1.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/landing-page-library/landing-page-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/Google/target/classes"/>

View File

@ -8,4 +8,7 @@
<Changeset component="gr.cite.google.1-1-1" date="2016-12-13">
<Change>Fixed a bug concerning users with no google+ available where the authenticated response did not include given and family names</Change>
</Changeset>
<Changeset component="gr.cite.google.1-3-0" date="2018-03-13">
<Change>Feature #11432, D4Science Gateway user registration: confirmation email is sent upon new user registration via Google or LinkedIn SSO</Change>
</Changeset>
</ReleaseNotes>

View File

@ -19,7 +19,7 @@
<description>
The Google hook allows users to login with their Google credentials to a liferay portal
</description>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<scm>
<connection>scm:svn:http://svn.cite.gr/code-bluebridge/google-hook</connection>

View File

@ -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{

View File

@ -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,

View File

@ -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
page-url=http://www.gcube-system.org
author=M. Nikolopoulos, M. Assante
licenses=EUPS