User registration and email confirmation


#1

Hello. I’m trying to build a registration that use email confirmation with “User registration default” email template.
When I try to force a registration with the API Docs register(), the DSP send the email that is like this:

Hi silconsul,
You have registered as a mauri user. Go to the following url, enter the
code below, and set your password to confirm your account.

http://localhost/dreamfactory/dist/#/register-confirm

Confirmation Code: 7b3d223190702f1a7083683c01a80b8a

Thanks,
DreamFactory

My problems are:

  1. the link to the registration confirmation is not clickable
  2. if I copy the link and I try to open this link with a browser, the browser open the Start page of Dreamfactory services Platform, without showing me any kind of page where I should put the password and the code confirmation.

In Config -> Email Templates I can see the Body in this way:
Hi {first_name},

You have registered as a {dsp.name} user. Go to the following url, enter the code below, and set your password to confirm your account.



{dsp.confirm_register_url}



Confirmation Code: {confirm_code}



Thanks,

{from_name}

and I tried to join a Lookup key with the name “dsp.confirm_register_url” but I dont know how I must set the Value of this variable.
I saw an example in C:\Bitnami\dreamfactory-1.9.4-0\apps\dreamfactory\htdocs\web\confirm_reg.html:
that can be a good value of the variable “dsp.confirm_register_url” ? If yes, how I can set the DSP to link the email confirmation to this url ?
Thank you
Best regards

Mauri


Create User with Suspended State and Activate them with custom URL
Custom scripts directory
#2

I have moved the above post from Custom scripts directory because it was off-topic.

Full HTML formatting is supported in email templates. It’s a simple matter to edit the User Invite template body to include, say,

<a href="{dsp.confirm_invite_url}">Click here to complete your registration.</a>

Which looks like this when I receive the invitation email:

Clicking the link takes you to {DreamFactoryURL}/dreamfactory/dist/#/user-invite

Now you can’t click the link in the same browser where you already have an active session in your DreamFactory instance. It’s smart enough to know that you already have a valid session so you can’t be required to confirm your registration. Of course a newly invited user won’t already have a session like you do, so they’ll see the user-invite page (for the screenshot below, I opened the link in Firefox since I had an active DreamFactory session in Chrome):

Some of this is also covered in these forum topics:

{dsp.confirm_register_url} is a system variable that is pre-defined based on where and how you host your instance. You can define your own lookup variables and use those in the email templates, if you prefer. Here’s the relevant page from our docs.

Note all of the above examples are for User Invite and not User Registration. The same principles apply for your situation.


#3

Thank you very much for your support: I’m a newbie in that and for me is all to learn.
Your hints works very well.
I’d like to ask another thing:
it is possible after doing “Click here to complete your registration”, in the web page “Invitation confirmation” the fields “EnterEmail” and “Enter confirmation code” will be automatically filled with the right values ? How can I obtain that ? Or at least I would that the field of confirmation code will be automatically filled.
Thank you again
Best regards.

Mauri


#4

The confirmation payload that is POSTed to {DreamFactoryURL}/rest/user/register?login=false by the included {DreamFactoryURL}/dreamfactory/dist/#/user-invite page takes the following format:

{
  "email":"",
  "code":"",
  "new_password":"",
  "verify_password":""
}

So you could write your own confirmation page or rewrite the included one to capture the email and code values and populate them, given you also rewrite the email template and confirmation URL to include those values. The provided confirmation scheme is just an example of what you could accomplish. Given that it’s branded with DreamFactory we don’t expect you’ll continue to use it as-is for an app in production.


#5

I think the confirmation payload is POSTed to {DreamFactoryURL}/rest/user/password?login=false .


#6

Just to clarify, if you are performing a password reset, you would post to user/password
If you are performing a registration confirmation, you would post to user/register