Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: domain name instead ip address into email verification
Hello to all,
I have a small problem. When I create a account into my portal, the registration verification URL with the ticket is built with the ip address instead of the site name.
In the portal settings I have correctly set the Virtual Host field with the domain name. In fact, the site works correctly even when I enter the other pages.
The only problem I have in the mail where the variable [$ EMAIL_VERIFICATION_URL $] is built like this: http: // IPADDRESS: PORT / verify .... etc ... etc ..
But I would like it to be http: //www.domainname.ext/verify ..... etc..ecc ...
Thanks so much
Which version are you referring to?
Version independent: If you are using a reverse proxy (Apache
httpd? Nginx? Another one?) with improper configuration, it might be
swallowing the host name. Share or validate your configuration if you
need help.
And a quick fix (not for all issues, but maybe for this one) could be to use at these properties. Even if these settings work, I'd still recommend to check underlying issues like reverse proxies
Hi,
I set web.server.host but it didn't change.
The API addUser
take as last parameter the serviceContext.
Thinking......the registration is done by a web service json into liferay, could it be that the service context is empty and so it simply takes the ip address instead of the domain name?
Another question is that the registration email goes into spam folder of gmail.... ?????
thank you
Fabrizio Attanasio:Hi,
I set web.server.host but it didn't change.
The API addUser take as last parameter the serviceContext.Thinking......the registration is done by a web service json into liferay, could it be that the service context is empty and so it simply takes the ip address instead of the domain name?
Another question is that the registration email goes into spam folder of gmail.... ?????
Ok, it's time to ask for actual steps to reproduce.
Which (exact) version? How do you register?
And I assume that you restarted after setting web.server.host (as that's required with changes to portal-ext.properties)
ok.... :)
version: Liferay 6.2 CE
registration function in web service added into MyCustomUserServiceImpl class:
....with this code:
@AccessControlled(guestAccessEnabled=true)
@JSONWebService(method="POST",value="/creaUser")
public Object creaUser(String usrws,String pwdws,long
companyId,String nome,String cognome,String email,String
codiceFiscale,int codUtenteBooking){
.....
.....
....
ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
ut = UserLocalServiceUtil.addUser(20433,
companyId,true, "", "",true, StringPool.BLANK,
email.trim(),0l,"",Locale.ITALY, nome.trim(),
StringPool.BLANK, cognome.trim(), 0, 0, true, 1, 1, 2017,
StringPool.BLANK, null, null, new long[]{ROLE_UTENTE_APP}, null, true,
serviceContext);
......
......
}
Yes, i restart portal after change portal.properties in the hook.
Thank you
Fabrizio Attanasio:ok.... :)
version: Liferay 6.2 CE
I was hoping for the exact version, e.g. one digit more. Anyways...
Repeating my question from earlier: Are you using a reverse proxy? As you create the service context for the call: Instead of assuming that it "might be empty", you can also just inspect it - e.g. using the various get***URL methods. I'm assuming that it is properly initialized, contains the IP-Address instead of the domain name, and my assumption is that this is largely due to a misconfigured reverse proxy.
Plus, answering that other question: It's hard to say why an email would be flagged as spam, but containing an IP-Address-URL is a good assumption to start with.
Sorry, the version is liferay 6.2-ce-ga5
I have this configuration of apache2 virtual host:
<VirtualHost *:80>
ServerName www.domainname.it
ServerAlias domainname.it
ProxyRequests Off
<Proxy *>
Order deny,allow
allow from all
</Proxy>
ProxyPreserveHost On
ProxyPass / http://IPADDRESS:PORT/
ProxyPassReverse /
http://IPADDRESS:PORT/
</VirtualHost>
Yes, It seems to be because of ServiceContext. Can you log what is there in serviceContext.getPortalURL(). If it prints out IP then that is the root cause. Simply set the portalURL there. You can use PortalUtil to get portal URL. There are a bunch of utility methods to get the portalURL based on various parameters. See which one fits you and use the same.
Regards,
Sandeep
I have also the same problem When I create an account into my portal, the registration verification URL with the ticket is built with the ip address instead of the site name. Actually, I am using the Hotmail service so, regarding this problem I consult with the Hotmail support team by clicking Hotmail Support Number general inquiry about this problem.