diff --git a/app/controllers/auth.php b/app/controllers/auth.php index 96bf3ae64..5c8af0bf3 100644 --- a/app/controllers/auth.php +++ b/app/controllers/auth.php @@ -30,12 +30,12 @@ $utopia->post('/v1/auth/register') ->label('abuse-limit', 10) ->param('email', '', function () {return new Email();}, 'Account email') ->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('failure', null, function () use ($clients) {return new Host($clients);}, 'Redirect when registration failed', true) ->param('name', '', function () {return new Text(100);}, 'User name', true) ->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()) { $whitlistEmails = $project->getAttribute('authWhitelistEmails'); $whitlistIPs = $project->getAttribute('authWhitelistIPs'); @@ -132,16 +132,16 @@ $utopia->post('/v1/auth/register') // Send email address confirmation email - $confirmation = Template::parseURL($confirmation); - $confirmation['query'] = Template::mergeQuery(((isset($confirmation['query'])) ? $confirmation['query'] : ''), ['userId' => $user->getUid(), 'token' => $confirmSecret]); - $confirmation = Template::unParseURL($confirmation); + $confirm = Template::parseURL($confirm); + $confirm['query'] = Template::mergeQuery(((isset($confirm['query'])) ? $confirm['query'] : ''), ['userId' => $user->getUid(), 'token' => $confirmSecret]); + $confirm = Template::unParseURL($confirm); $body = new Template(__DIR__.'/../config/locale/templates/'.Locale::getText('auth.emails.confirm.body')); $body ->setParam('{{direction}}', Locale::getText('settings.direction')) ->setParam('{{project}}', $project->getAttribute('name', ['[APP-NAME]'])) ->setParam('{{name}}', $name) - ->setParam('{{redirect}}', $confirmation) + ->setParam('{{redirect}}', $confirm) ; $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('abuse-limit', 10) ->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( - function ($confirmation) use ($response, $request, $projectDB, $user, $register, $project) { + function ($confirm) use ($response, $request, $projectDB, $user, $register, $project) { if ($user->getAttribute('confirm', false)) { 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); } - $confirmation = Template::parseURL($confirmation); - $confirmation['query'] = Template::mergeQuery(((isset($confirmation['query'])) ? $confirmation['query'] : ''), ['userId' => $user->getUid(), 'token' => $secret]); - $confirmation = Template::unParseURL($confirmation); + $confirm = Template::parseURL($confirm); + $confirm['query'] = Template::mergeQuery(((isset($confirm['query'])) ? $confirm['query'] : ''), ['userId' => $user->getUid(), 'token' => $secret]); + $confirm = Template::unParseURL($confirm); $body = new Template(__DIR__.'/../config/locale/templates/'.Locale::getText('auth.emails.confirm.body')); $body ->setParam('{{direction}}', Locale::getText('settings.direction')) ->setParam('{{project}}', $project->getAttribute('name', ['[APP-NAME]'])) ->setParam('{{name}}', $user->getAttribute('name')) - ->setParam('{{redirect}}', $confirmation) + ->setParam('{{redirect}}', $confirm) ; $mail = $register->get('smtp'); /* @var $mail \PHPMailer\PHPMailer\PHPMailer */ diff --git a/app/views/home/auth/recovery.phtml b/app/views/home/auth/recovery.phtml index 9511c66b8..9e5fd590f 100644 --- a/app/views/home/auth/recovery.phtml +++ b/app/views/home/auth/recovery.phtml @@ -18,7 +18,7 @@ - + diff --git a/app/views/home/auth/signup.phtml b/app/views/home/auth/signup.phtml index 0399bcc2e..f0882531f 100644 --- a/app/views/home/auth/signup.phtml +++ b/app/views/home/auth/signup.phtml @@ -18,7 +18,7 @@ data-failure-param-alert-text="Registration Failed. Please try again later" data-failure-param-alert-classname="error"> - + diff --git a/tests/e2e/BaseConsole.php b/tests/e2e/BaseConsole.php index 14787e510..a5ca5e87d 100644 --- a/tests/e2e/BaseConsole.php +++ b/tests/e2e/BaseConsole.php @@ -39,7 +39,7 @@ class BaseConsole extends TestCase ], [ 'email' => $this->demoEmail, 'password' => $this->demoPassword, - 'confirmation' => 'http://localhost/confirm', + 'confirm' => 'http://localhost/confirm', 'success' => 'http://localhost/success', 'failure' => 'http://localhost/failure', 'name' => 'Demo User', diff --git a/tests/e2e/BaseProjects.php b/tests/e2e/BaseProjects.php index bb6512231..64e84b76e 100644 --- a/tests/e2e/BaseProjects.php +++ b/tests/e2e/BaseProjects.php @@ -36,7 +36,7 @@ class BaseProjects extends BaseConsole ], [ 'email' => $this->projectsDemoEmail, 'password' => $this->projectsDemoPassword, - 'confirmation' => 'http://localhost/confirm', + 'confirm' => 'http://localhost/confirm', 'success' => 'http://localhost/success', 'failure' => 'http://localhost/failure', 'name' => 'Porject Demo User',