Changed confirmation to confirm
This commit is contained in:
parent
671d524688
commit
ee62fdb88f
|
@ -30,12 +30,12 @@ $utopia->post('/v1/auth/register')
|
||||||
->label('abuse-limit', 10)
|
->label('abuse-limit', 10)
|
||||||
->param('email', '', function () {return new Email();}, 'Account email')
|
->param('email', '', function () {return new Email();}, 'Account email')
|
||||||
->param('password', '', function () {return new Password();}, 'User password')
|
->param('password', '', function () {return new Password();}, 'User password')
|
||||||
->param('confirmation', '', function () use ($clients) {return new Host($clients);}, 'Confirmation URL to redirect user after confirm token has been sent to user email') // TODO add our own built-in confirm page
|
->param('confirm', '', function () use ($clients) {return new Host($clients);}, 'Confirmation URL to redirect user after confirm token has been sent to user email') // TODO add our own built-in confirm page
|
||||||
->param('success', null, function () use ($clients) {return new Host($clients);}, 'Redirect when registration succeed', true)
|
->param('success', null, function () use ($clients) {return new Host($clients);}, 'Redirect when registration succeed', true)
|
||||||
->param('failure', null, function () use ($clients) {return new Host($clients);}, 'Redirect when registration failed', true)
|
->param('failure', null, function () use ($clients) {return new Host($clients);}, 'Redirect when registration failed', true)
|
||||||
->param('name', '', function () {return new Text(100);}, 'User name', true)
|
->param('name', '', function () {return new Text(100);}, 'User name', true)
|
||||||
->action(
|
->action(
|
||||||
function ($email, $password, $confirmation, $success, $failure, $name) use ($request, $response, $register, $audit, $projectDB, $project, $webhook) {
|
function ($email, $password, $confirm, $success, $failure, $name) use ($request, $response, $register, $audit, $projectDB, $project, $webhook) {
|
||||||
if('console' === $project->getUid()) {
|
if('console' === $project->getUid()) {
|
||||||
$whitlistEmails = $project->getAttribute('authWhitelistEmails');
|
$whitlistEmails = $project->getAttribute('authWhitelistEmails');
|
||||||
$whitlistIPs = $project->getAttribute('authWhitelistIPs');
|
$whitlistIPs = $project->getAttribute('authWhitelistIPs');
|
||||||
|
@ -132,16 +132,16 @@ $utopia->post('/v1/auth/register')
|
||||||
|
|
||||||
// Send email address confirmation email
|
// Send email address confirmation email
|
||||||
|
|
||||||
$confirmation = Template::parseURL($confirmation);
|
$confirm = Template::parseURL($confirm);
|
||||||
$confirmation['query'] = Template::mergeQuery(((isset($confirmation['query'])) ? $confirmation['query'] : ''), ['userId' => $user->getUid(), 'token' => $confirmSecret]);
|
$confirm['query'] = Template::mergeQuery(((isset($confirm['query'])) ? $confirm['query'] : ''), ['userId' => $user->getUid(), 'token' => $confirmSecret]);
|
||||||
$confirmation = Template::unParseURL($confirmation);
|
$confirm = Template::unParseURL($confirm);
|
||||||
|
|
||||||
$body = new Template(__DIR__.'/../config/locale/templates/'.Locale::getText('auth.emails.confirm.body'));
|
$body = new Template(__DIR__.'/../config/locale/templates/'.Locale::getText('auth.emails.confirm.body'));
|
||||||
$body
|
$body
|
||||||
->setParam('{{direction}}', Locale::getText('settings.direction'))
|
->setParam('{{direction}}', Locale::getText('settings.direction'))
|
||||||
->setParam('{{project}}', $project->getAttribute('name', ['[APP-NAME]']))
|
->setParam('{{project}}', $project->getAttribute('name', ['[APP-NAME]']))
|
||||||
->setParam('{{name}}', $name)
|
->setParam('{{name}}', $name)
|
||||||
->setParam('{{redirect}}', $confirmation)
|
->setParam('{{redirect}}', $confirm)
|
||||||
;
|
;
|
||||||
|
|
||||||
$mail = $register->get('smtp'); /* @var $mail \PHPMailer\PHPMailer\PHPMailer */
|
$mail = $register->get('smtp'); /* @var $mail \PHPMailer\PHPMailer\PHPMailer */
|
||||||
|
@ -244,9 +244,9 @@ $utopia->post('/v1/auth/register/confirm/resend')
|
||||||
->label('sdk.description', "This endpoint allows the user to request your app to resend him his email confirmation message. The redirect arguments acts the same way as in /auth/register endpoint.\n\nPlease notice that in order to avoid a [Redirect Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.")
|
->label('sdk.description', "This endpoint allows the user to request your app to resend him his email confirmation message. The redirect arguments acts the same way as in /auth/register endpoint.\n\nPlease notice that in order to avoid a [Redirect Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.")
|
||||||
->label('abuse-limit', 10)
|
->label('abuse-limit', 10)
|
||||||
->label('abuse-key', 'url:{url},userId:{param-userId}')
|
->label('abuse-key', 'url:{url},userId:{param-userId}')
|
||||||
->param('confirmation', '', function () use ($clients) {return new Host($clients);}, 'Confirmation URL to redirect user to your app after confirm token has been sent to user email.')
|
->param('confirm', '', function () use ($clients) {return new Host($clients);}, 'Confirmation URL to redirect user to your app after confirm token has been sent to user email.')
|
||||||
->action(
|
->action(
|
||||||
function ($confirmation) use ($response, $request, $projectDB, $user, $register, $project) {
|
function ($confirm) use ($response, $request, $projectDB, $user, $register, $project) {
|
||||||
if ($user->getAttribute('confirm', false)) {
|
if ($user->getAttribute('confirm', false)) {
|
||||||
throw new Exception('Email address is already confirmed', 400);
|
throw new Exception('Email address is already confirmed', 400);
|
||||||
}
|
}
|
||||||
|
@ -269,16 +269,16 @@ $utopia->post('/v1/auth/register/confirm/resend')
|
||||||
throw new Exception('Failed saving user to DB', 500);
|
throw new Exception('Failed saving user to DB', 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
$confirmation = Template::parseURL($confirmation);
|
$confirm = Template::parseURL($confirm);
|
||||||
$confirmation['query'] = Template::mergeQuery(((isset($confirmation['query'])) ? $confirmation['query'] : ''), ['userId' => $user->getUid(), 'token' => $secret]);
|
$confirm['query'] = Template::mergeQuery(((isset($confirm['query'])) ? $confirm['query'] : ''), ['userId' => $user->getUid(), 'token' => $secret]);
|
||||||
$confirmation = Template::unParseURL($confirmation);
|
$confirm = Template::unParseURL($confirm);
|
||||||
|
|
||||||
$body = new Template(__DIR__.'/../config/locale/templates/'.Locale::getText('auth.emails.confirm.body'));
|
$body = new Template(__DIR__.'/../config/locale/templates/'.Locale::getText('auth.emails.confirm.body'));
|
||||||
$body
|
$body
|
||||||
->setParam('{{direction}}', Locale::getText('settings.direction'))
|
->setParam('{{direction}}', Locale::getText('settings.direction'))
|
||||||
->setParam('{{project}}', $project->getAttribute('name', ['[APP-NAME]']))
|
->setParam('{{project}}', $project->getAttribute('name', ['[APP-NAME]']))
|
||||||
->setParam('{{name}}', $user->getAttribute('name'))
|
->setParam('{{name}}', $user->getAttribute('name'))
|
||||||
->setParam('{{redirect}}', $confirmation)
|
->setParam('{{redirect}}', $confirm)
|
||||||
;
|
;
|
||||||
|
|
||||||
$mail = $register->get('smtp'); /* @var $mail \PHPMailer\PHPMailer\PHPMailer */
|
$mail = $register->get('smtp'); /* @var $mail \PHPMailer\PHPMailer\PHPMailer */
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<label>Email</label>
|
<label>Email</label>
|
||||||
<input name="email" type="email" class="full-width" autocomplete="email" placeholder="me@example.com" required>
|
<input name="email" type="email" class="full-width" autocomplete="email" placeholder="me@example.com" required>
|
||||||
|
|
||||||
<input name="confirmation" type="hidden" data-ls-bind="{{env.PROTOCOL}}://{{env.DOMAIN}}/auth/recovery/reset" />
|
<input name="confirm" type="hidden" data-ls-bind="{{env.PROTOCOL}}://{{env.DOMAIN}}/auth/recovery/reset" />
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary"><i class="fa fa-sign-in"></i> Recover</button>
|
<button type="submit" class="btn btn-primary"><i class="fa fa-sign-in"></i> Recover</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
data-failure-param-alert-text="Registration Failed. Please try again later"
|
data-failure-param-alert-text="Registration Failed. Please try again later"
|
||||||
data-failure-param-alert-classname="error">
|
data-failure-param-alert-classname="error">
|
||||||
|
|
||||||
<input name="confirmation" type="hidden" data-ls-bind="{{env.PROTOCOL}}://{{env.DOMAIN}}/console">
|
<input name="confirm" type="hidden" data-ls-bind="{{env.PROTOCOL}}://{{env.DOMAIN}}/console">
|
||||||
<input name="success" type="hidden" data-ls-bind="{{env.PROTOCOL}}://{{env.DOMAIN}}/console">
|
<input name="success" type="hidden" data-ls-bind="{{env.PROTOCOL}}://{{env.DOMAIN}}/console">
|
||||||
<input name="failure" type="hidden" data-ls-bind="{{env.PROTOCOL}}://{{env.DOMAIN}}/auth/signup?failure=1">
|
<input name="failure" type="hidden" data-ls-bind="{{env.PROTOCOL}}://{{env.DOMAIN}}/auth/signup?failure=1">
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class BaseConsole extends TestCase
|
||||||
], [
|
], [
|
||||||
'email' => $this->demoEmail,
|
'email' => $this->demoEmail,
|
||||||
'password' => $this->demoPassword,
|
'password' => $this->demoPassword,
|
||||||
'confirmation' => 'http://localhost/confirm',
|
'confirm' => 'http://localhost/confirm',
|
||||||
'success' => 'http://localhost/success',
|
'success' => 'http://localhost/success',
|
||||||
'failure' => 'http://localhost/failure',
|
'failure' => 'http://localhost/failure',
|
||||||
'name' => 'Demo User',
|
'name' => 'Demo User',
|
||||||
|
|
|
@ -36,7 +36,7 @@ class BaseProjects extends BaseConsole
|
||||||
], [
|
], [
|
||||||
'email' => $this->projectsDemoEmail,
|
'email' => $this->projectsDemoEmail,
|
||||||
'password' => $this->projectsDemoPassword,
|
'password' => $this->projectsDemoPassword,
|
||||||
'confirmation' => 'http://localhost/confirm',
|
'confirm' => 'http://localhost/confirm',
|
||||||
'success' => 'http://localhost/success',
|
'success' => 'http://localhost/success',
|
||||||
'failure' => 'http://localhost/failure',
|
'failure' => 'http://localhost/failure',
|
||||||
'name' => 'Porject Demo User',
|
'name' => 'Porject Demo User',
|
||||||
|
|
Loading…
Reference in a new issue