You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Johan Cronje <jo...@gmail.com> on 2022/06/23 10:24:43 UTC
Password Change Email
Good Day,
Not sure if someone would be able to assist me, in release18.12, when
doing the forgot password function a mail is sent with reset link. The
code behind this is as below within
"applications/securityext/template/email/PasswordEmail.ftl"
<@ofbizUrl fullPath="true" secure="true"
webSiteId="${webSiteId!}">passwordChange</...@ofbizUrl>
Currently this outputs only "passwordChange" however I am expecting it
in a format like
"https://www.hostname.com:8443/webappName/control/passwordChange" or
"http://localhost:8443/webappName/control/passwordChange"
Is this correct, or is there maybe a setting that I can change to get
the @ofbizUrl functioning?
Any advice will be appreciated.
Kind Regards,
Johan Cronjé
Re: Password Change Email
Posted by Ashish Vijaywargiya <as...@hotwaxsystems.com>.
Hello Johan,
The forgot email
template(applications/securityext/template/email/PasswordEmail.ftl)
provided in Apache OFBiz is a sample template and you can customise it
based on your need. In the current template <ofbizUrl> is being used in the
<Form> tag but you can use it in the email body as well.
I tried this functionality on my machine and see the console output:
<!-- Begin Screen
component://securityext/widget/EmailSecurityScreens.xml#PasswordEmail -->
<!-- Begin Template
component://securityext/template/email/PasswordEmail.ftl -->
<html>
<head>
</head>
<body>
<div>This email is in response to your request to have a new
password.</div>
<div>Please ignore this email if you did not request a password
change.</div>
<br />
The value of websiteId is WebStore
<div>
<form method="post"
action="https%3A%2F%2Flocalhost%3A8443%2Fecommerce%2Fcontrol%2F%2FpasswordChange?USERNAME=ashish.vijaywargiya@
abc.com&TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ1c2VyTG9naW5JZCI6ImFzaGlzaC52aWpheXdhcZCaXoiLCJleHAiOjE2NTU5OTIwMDQsImlhdCI6MTY1NTk5MDIwNH0.zHyZVxx16fE0v5d5rRYzrXQd3f8ZaSv5UN8FdnrcFJeocxdexaQ7Ii7aou7qG5NyodIzwI8060LZ7y1U8b5xxQ&forgotPwdFlag=true&tenantId="
name="loginform" id="loginform" target="_blank">
<input type="submit" name="submit" value="Click Here To Reset
Password" />
</form>
This link can be used only once.
</div>
</body>
</html>
<!-- End Template component://securityext/template/email/PasswordEmail.ftl
-->
<!-- End Screen
component://securityext/widget/EmailSecurityScreens.xml#PasswordEmail -->
If you will see the action attribute of form them you will notice that it
is creating a URL which will be submitted when someone clicks on "Click
Here To Reset Password".
For security reasons it is done like this.
Additional technical details:
You need to add two field values in the Website entity so that it could
take the base URL(domain name) in the email body. Those two fields are:
Website.httpHost and Website.httpsHost(
https://localhost:8443/webtools/control/ViewGeneric?entityName=WebSite&webSiteId=WebStore
)
Hope this helps!
--
Kind Regards,
Ashish Vijaywargiya
Vice President of Operations
*HotWax Systems*
*Enterprise open source experts*
http://www.hotwaxsystems.com
On Thu, Jun 23, 2022 at 3:55 PM Johan Cronje <jo...@gmail.com>
wrote:
> Good Day,
>
> Not sure if someone would be able to assist me, in release18.12, when
> doing the forgot password function a mail is sent with reset link. The
> code behind this is as below within
> "applications/securityext/template/email/PasswordEmail.ftl"
>
> <@ofbizUrl fullPath="true" secure="true"
> webSiteId="${webSiteId!}">passwordChange</...@ofbizUrl>
>
> Currently this outputs only "passwordChange" however I am expecting it
> in a format like
> "https://www.hostname.com:8443/webappName/control/passwordChange" or
> "http://localhost:8443/webappName/control/passwordChange"
>
> Is this correct, or is there maybe a setting that I can change to get
> the @ofbizUrl functioning?
>
> Any advice will be appreciated.
>
> Kind Regards,
> Johan Cronjé
>