Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
04ea008fc8
|
@ -98,8 +98,8 @@ We really ❤️ pull requests! If you wish to help, you can learn more about ho
|
|||
|
||||
Created by [Eldad Fux](https://twitter.com/eldadfux) with the amazing help of our **amazing contributors:**
|
||||
|
||||
* 🇺🇸Justin Dorfman ([Github](https://github.com/@jdorfman), [Twitter](https://twitter.com/jdorfman))
|
||||
* 🇺🇸Justin Dorfman ([Github](https://github.com/jdorfman), [Twitter](https://twitter.com/jdorfman))
|
||||
* 🇺🇳0xflotus ([Github](https://github.com/0xflotus))
|
||||
* 🇳🇴Chaaarles ([Github](https://github.com/Chaaarles))
|
||||
* 🇳🇴Petter Charles Redfern ([Github](https://github.com/Chaaarles))
|
||||
* 🇧🇷Jessé Souza ([Github](https://github.com/jessescn))
|
||||
* 🇪🇸Esther Álvarez Feijoo ([Github](https://github.com/EstherAF))
|
|
@ -611,6 +611,7 @@ $utopia->get('/v1/open-api-2.json')
|
|||
$temp['extensions'] = [
|
||||
'weight' => $route->getOrder(),
|
||||
'cookies' => $route->getLabel('sdk.cookies', false),
|
||||
'location' => $route->getLabel('sdk.location', false),
|
||||
'demo' => 'docs/examples/' . fromCamelCaseToDash($route->getLabel('sdk.namespace', 'default')) . '/' . fromCamelCaseToDash($temp['operationId']) . '.md',
|
||||
];
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ return [
|
|||
'tag' => 'Soon',
|
||||
],
|
||||
[
|
||||
'label' => '.NET',
|
||||
'label' => 'C#',
|
||||
'versions' => [],
|
||||
'logo' => 'dotnet.svg',
|
||||
'link' => 'https://...',
|
||||
|
|
|
@ -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 */
|
||||
|
@ -597,6 +597,7 @@ $utopia->get('/v1/auth/oauth/:provider')
|
|||
->label('scope', 'auth')
|
||||
->label('sdk.namespace', 'auth')
|
||||
->label('sdk.method', 'oauth')
|
||||
->label('sdk.location', true)
|
||||
->label('abuse-limit', 50)
|
||||
->label('abuse-key', 'ip:{ip}')
|
||||
->param('provider', '', function () use ($providers) {return new WhiteList(array_keys($providers));}, 'OAuth Provider')
|
||||
|
@ -635,10 +636,11 @@ $utopia->get('/v1/auth/oauth/callback/:provider/:projectId')
|
|||
->desc('OAuth Callback')
|
||||
->label('error', __DIR__.'/../views/general/error.phtml')
|
||||
->label('scope', 'auth')
|
||||
->label('sdk.namespace', 'auth')
|
||||
->label('sdk.method', 'oauthCallback')
|
||||
//->label('sdk.namespace', 'auth')
|
||||
//->label('sdk.method', 'oauthCallback')
|
||||
->label('abuse-limit', 50)
|
||||
->label('abuse-key', 'ip:{ip}')
|
||||
->label('docs', false)
|
||||
->param('projectId', '', function () {return new Text(1024);}, 'Project unique ID')
|
||||
->param('provider', '', function () use ($providers) {return new WhiteList(array_keys($providers));}, 'OAuth provider')
|
||||
->param('code', '', function () {return new Text(1024);}, 'OAuth code')
|
||||
|
@ -655,8 +657,8 @@ $utopia->get('/v1/auth/oauth/:provider/redirect')
|
|||
->label('error', __DIR__.'/../views/general/error.phtml')
|
||||
->label('webhook', 'auth.oauth')
|
||||
->label('scope', 'auth')
|
||||
->label('sdk.namespace', 'auth')
|
||||
->label('sdk.method', 'oauthRedirect')
|
||||
//->label('sdk.namespace', 'auth')
|
||||
//->label('sdk.method', 'oauthRedirect')
|
||||
->label('abuse-limit', 50)
|
||||
->label('abuse-key', 'ip:{ip}')
|
||||
->label('docs', false)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<label>Email</label>
|
||||
<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>
|
||||
</form>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
data-failure-param-alert-text="Registration Failed. Please try again later"
|
||||
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="failure" type="hidden" data-ls-bind="{{env.PROTOCOL}}://{{env.DOMAIN}}/auth/signup?failure=1">
|
||||
|
||||
|
|
1432
composer.lock
generated
1432
composer.lock
generated
File diff suppressed because it is too large
Load diff
10
public/dist/scripts/app-all.js
vendored
10
public/dist/scripts/app-all.js
vendored
|
@ -38,15 +38,15 @@ let path='/auth/recovery';return http.post(path,{'content-type':'application/jso
|
|||
if(token===undefined){throw new Error('Missing required parameter: "token"');}
|
||||
if(passwordA===undefined){throw new Error('Missing required parameter: "passwordA"');}
|
||||
if(passwordB===undefined){throw new Error('Missing required parameter: "passwordB"');}
|
||||
let path='/auth/recovery/reset';return http.put(path,{'content-type':'application/json'},{'userId':userId,'token':token,'password-a':passwordA,'password-b':passwordB});},register:function(email,password,confirmation,success,failure,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');}
|
||||
let path='/auth/recovery/reset';return http.put(path,{'content-type':'application/json'},{'userId':userId,'token':token,'password-a':passwordA,'password-b':passwordB});},register:function(email,password,confirm,success,failure,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');}
|
||||
if(password===undefined){throw new Error('Missing required parameter: "password"');}
|
||||
if(confirmation===undefined){throw new Error('Missing required parameter: "confirmation"');}
|
||||
if(confirm===undefined){throw new Error('Missing required parameter: "confirm"');}
|
||||
if(success===undefined){throw new Error('Missing required parameter: "success"');}
|
||||
if(failure===undefined){throw new Error('Missing required parameter: "failure"');}
|
||||
let path='/auth/register';return iframe('post',path,{project:config.project,'email':email,'password':password,'confirmation':confirmation,'success':success,'failure':failure,'name':name});},confirm:function(userId,token){if(userId===undefined){throw new Error('Missing required parameter: "userId"');}
|
||||
let path='/auth/register';return iframe('post',path,{project:config.project,'email':email,'password':password,'confirm':confirm,'success':success,'failure':failure,'name':name});},confirm:function(userId,token){if(userId===undefined){throw new Error('Missing required parameter: "userId"');}
|
||||
if(token===undefined){throw new Error('Missing required parameter: "token"');}
|
||||
let path='/auth/register/confirm';return http.post(path,{'content-type':'application/json'},{'userId':userId,'token':token});},confirmResend:function(redirect){if(redirect===undefined){throw new Error('Missing required parameter: "redirect"');}
|
||||
let path='/auth/register/confirm/resend';return http.post(path,{'content-type':'application/json'},{'redirect':redirect});}};let avatars={getBrowser:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
let path='/auth/register/confirm';return http.post(path,{'content-type':'application/json'},{'userId':userId,'token':token});},confirmResend:function(confirm){if(confirm===undefined){throw new Error('Missing required parameter: "confirm"');}
|
||||
let path='/auth/register/confirm/resend';return http.post(path,{'content-type':'application/json'},{'confirm':confirm});}};let avatars={getBrowser:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);return http.get(path,{'content-type':'application/json'},{'width':width,'height':height,'quality':quality});},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);return http.get(path,{'content-type':'application/json'},{'width':width,'height':height,'quality':quality});},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||
let path='/avatars/favicon';return http.get(path,{'content-type':'application/json'},{'url':url});},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
|
|
10
public/dist/scripts/app-dep.js
vendored
10
public/dist/scripts/app-dep.js
vendored
|
@ -38,15 +38,15 @@ let path='/auth/recovery';return http.post(path,{'content-type':'application/jso
|
|||
if(token===undefined){throw new Error('Missing required parameter: "token"');}
|
||||
if(passwordA===undefined){throw new Error('Missing required parameter: "passwordA"');}
|
||||
if(passwordB===undefined){throw new Error('Missing required parameter: "passwordB"');}
|
||||
let path='/auth/recovery/reset';return http.put(path,{'content-type':'application/json'},{'userId':userId,'token':token,'password-a':passwordA,'password-b':passwordB});},register:function(email,password,confirmation,success,failure,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');}
|
||||
let path='/auth/recovery/reset';return http.put(path,{'content-type':'application/json'},{'userId':userId,'token':token,'password-a':passwordA,'password-b':passwordB});},register:function(email,password,confirm,success,failure,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');}
|
||||
if(password===undefined){throw new Error('Missing required parameter: "password"');}
|
||||
if(confirmation===undefined){throw new Error('Missing required parameter: "confirmation"');}
|
||||
if(confirm===undefined){throw new Error('Missing required parameter: "confirm"');}
|
||||
if(success===undefined){throw new Error('Missing required parameter: "success"');}
|
||||
if(failure===undefined){throw new Error('Missing required parameter: "failure"');}
|
||||
let path='/auth/register';return iframe('post',path,{project:config.project,'email':email,'password':password,'confirmation':confirmation,'success':success,'failure':failure,'name':name});},confirm:function(userId,token){if(userId===undefined){throw new Error('Missing required parameter: "userId"');}
|
||||
let path='/auth/register';return iframe('post',path,{project:config.project,'email':email,'password':password,'confirm':confirm,'success':success,'failure':failure,'name':name});},confirm:function(userId,token){if(userId===undefined){throw new Error('Missing required parameter: "userId"');}
|
||||
if(token===undefined){throw new Error('Missing required parameter: "token"');}
|
||||
let path='/auth/register/confirm';return http.post(path,{'content-type':'application/json'},{'userId':userId,'token':token});},confirmResend:function(redirect){if(redirect===undefined){throw new Error('Missing required parameter: "redirect"');}
|
||||
let path='/auth/register/confirm/resend';return http.post(path,{'content-type':'application/json'},{'redirect':redirect});}};let avatars={getBrowser:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
let path='/auth/register/confirm';return http.post(path,{'content-type':'application/json'},{'userId':userId,'token':token});},confirmResend:function(confirm){if(confirm===undefined){throw new Error('Missing required parameter: "confirm"');}
|
||||
let path='/auth/register/confirm/resend';return http.post(path,{'content-type':'application/json'},{'confirm':confirm});}};let avatars={getBrowser:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);return http.get(path,{'content-type':'application/json'},{'width':width,'height':height,'quality':quality});},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);return http.get(path,{'content-type':'application/json'},{'width':width,'height':height,'quality':quality});},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');}
|
||||
let path='/avatars/favicon';return http.get(path,{'content-type':'application/json'},{'url':url});},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');}
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -10,6 +10,8 @@ class ConsoleTest extends BaseConsole
|
|||
{
|
||||
$response = $this->register();
|
||||
|
||||
var_dump($_SERVER);
|
||||
|
||||
$this->assertEquals('http://localhost/success', $response['headers']['location']);
|
||||
$this->assertEquals("\n", $response['body']);
|
||||
|
||||
|
|
Loading…
Reference in a new issue