Custom reset password, accessing email template viariables

Hi guys,

I’m with an issue here.
Using the URL: http://localhost/api/v2/user/password?reset=true
And body parameters:

{
  "email": "user@domain.com.br"
}

Will use my email template to send the email to the client, like this for example:

We receive a notification to change the password to email: {email}
Att. {from_name}

Buuut, the email arrives to the client like this:
We receive a notification to change the password to email: {email}
Att. Kim Pastro

The {email} variable it’s not changing.

What could be wrong? The name of this variable have changed? Or some integration is missing?
Windows 8 with DF 2

Thanks.

[EDIT]
Have not found some place that describes those variables, like confirm_code. Any help would by great.

Hi everyone,
just found a solution to that.

I’ve notice that the DF default template email, to recover password, have this body: emails.password
And this template contain (pretty sure) some variables that could be used on the sent email.

So, I’ve cloned the project: https://github.com/dreamfactorysoftware/dreamfactory and search in whole project for emails variable. Then found this file:

my_project_dir/dreamfactory/resources/views/emails/register.blade.php

with this code:

@extends('emails.layout')
{{--

 This is an email blade for resetting password

 The following view data is required:

 $contentHeader       The callout/header of the email's body
 $firstName                The name of the recipient.
 $link                The password reset link.
 $code                The reset code.
 $instanceName        Name of the DreamFactory Instance.

--}}
@section('contentBody')
    <div style="padding: 10px;">
        <p>
            Hi {{ $firstName }},
        </p>

        <div>
            You have registered an user account on the DreamFactory instance of {{ $instanceName }}. Go to the following url, enter the code below, and set your password to confirm your account.<br/>
            <br/>
            {{ $link }}
            <br/><br/>
            Confirmation Code: {{ $code }}<br/>
        </div>

        <p>
            <cite>-- The Dream Team</cite>
        </p>
    </div>
@stop

So, I’ve presumed that “code” and “firstName” (in commentary section) is what I need.
Then put those guys in my custom template:

Hi, {firstName} <br/>
To reset your password go to our website and put the code below to proceed. <br/><br/>
Code: {code}

Bingo! Everything works like a charm.
That’s it, hope this would help someone someday.

Att. Kim

5 Likes