1
0
Fork 0
mirror of synced 2024-06-27 02:31:04 +12:00

Changed clients ref in auth and teams controllers

This commit is contained in:
eldadfux 2019-08-11 08:18:10 +03:00
parent 2f6b64e6fc
commit 164d252caa
6 changed files with 29 additions and 20 deletions

View file

@ -1,7 +1,7 @@
<?php
global $utopia, $register, $request, $response, $user, $audit, $webhook, $project, $domain, $projectDB, $providers;
global $utopia, $register, $request, $response, $user, $audit, $webhook, $project, $domain, $projectDB, $providers, $clients;
use Utopia\Exception;
use Utopia\Validator\WhiteList;
@ -40,9 +40,9 @@ $utopia->post('/v1/auth/register')
->param('email', '', function () {return new Email();}, 'Account email')
->param('password', '', function () {return new Password();}, 'User password')
->param('name', '', function () {return new Text(100);}, 'User name', true)
->param('redirect', '', function () use ($project) {return new Host($project->getAttribute('clients', []));}, 'Confirmation page to redirect user after confirm token has been sent to user email')
->param('success', null, function () use ($project) {return new Host($project->getAttribute('clients', []));}, 'Redirect when registration succeed', true)
->param('failure', null, function () use ($project) {return new Host($project->getAttribute('clients', []));}, 'Redirect when registration failed', true)
->param('redirect', '', function () use ($clients) {return new Host($clients);}, 'Confirmation page to redirect user after confirm token has been sent to user email')
->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)
->action(
function($email, $password, $name, $redirect, $success, $failure) use ($request, $response, $register, $audit, $projectDB, $project, $webhook)
{
@ -237,7 +237,7 @@ $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('redirect', '', function () use ($project) {return new Host($project->getAttribute('clients', []));}, 'Confirmation page to redirect user to your app after confirm token has been sent to user email.')
->param('redirect', '', function () use ($clients) {return new Host($clients);}, 'Confirmation page to redirect user to your app after confirm token has been sent to user email.')
->action(
function($redirect) use ($response, $request, $projectDB, $user, $register, $project)
{
@ -306,8 +306,8 @@ $utopia->post('/v1/auth/login')
->label('abuse-key', 'url:{url},email:{param-email}')
->param('email', '', function () {return new Email();}, 'User account email address')
->param('password', '', function () {return new Password();}, 'User account password')
->param('success', null, function () use ($project) {return new Host($project->getAttribute('clients', []));}, 'URL to redirect back to your app after a successful login attempt.', true)
->param('failure', null, function () use ($project) {return new Host($project->getAttribute('clients', []));}, 'URL to redirect back to your app after a failed login attempt.', true)
->param('success', null, function () use ($clients) {return new Host($clients);}, 'URL to redirect back to your app after a successful login attempt.', true)
->param('failure', null, function () use ($clients) {return new Host($clients);}, 'URL to redirect back to your app after a failed login attempt.', true)
->action(
function($email, $password, $success, $failure) use ($response, $request, $projectDB, $audit, $webhook)
{
@ -458,7 +458,7 @@ $utopia->post('/v1/auth/recovery')
->label('abuse-limit', 10)
->label('abuse-key', 'url:{url},email:{param-email}')
->param('email', '', function () {return new Email();}, 'User account email address.')
->param('redirect', '', function () use ($project) {return new Host($project->getAttribute('clients', []));}, 'Reset page in your app to redirect user after reset token has been sent to user email.')
->param('redirect', '', function () use ($clients) {return new Host($clients);}, 'Reset page in your app to redirect user after reset token has been sent to user email.')
->action(
function($email, $redirect) use ($request, $response, $projectDB, $register, $audit, $project)
{
@ -603,8 +603,8 @@ $utopia->get('/v1/oauth/:provider')
->label('abuse-limit', 50)
->label('abuse-key', 'ip:{ip}')
->param('provider', '', function () use ($providers) {return new WhiteList(array_keys($providers));}, 'OAuth Provider')
->param('success', '', function () use ($project) {return new Host($project->getAttribute('clients', []));}, 'URL to redirect back to your app after a successful login attempt.', true)
->param('failure', '', function () use ($project) {return new Host($project->getAttribute('clients', []));}, 'URL to redirect back to your app after a failed login attempt.', true)
->param('success', '', function () use ($clients) {return new Host($clients);}, 'URL to redirect back to your app after a successful login attempt.', true)
->param('failure', '', function () use ($clients) {return new Host($clients);}, 'URL to redirect back to your app after a failed login attempt.', true)
->action(
function($provider, $success, $failure) use ($response, $request, $project)
{

View file

@ -1,6 +1,6 @@
<?php
global $utopia, $register, $request, $response, $projectDB, $project, $user, $audit, $mode;
global $utopia, $register, $request, $response, $projectDB, $project, $user, $audit, $mode, $clients;
use Utopia\Exception;
use Utopia\Response;
@ -262,7 +262,7 @@ $utopia->post('/v1/teams/:teamId/memberships')
->param('email', '', function () {return new Email();}, 'New team member email address.')
->param('name', '', function () {return new Text(100);}, 'New team member name.', true)
->param('roles', [], function () {return new ArrayList(new Text(128));}, 'Invite roles array. Learn more about [roles and permissions](/docs/permissions).')
->param('redirect', '', function () use ($project) {return new Host($project->getAttribute('clients', []));}, 'Reset page to redirect user back to your app from the invitation email.')
->param('redirect', '', function () use ($clients) {return new Host($clients);}, 'Reset page to redirect user back to your app from the invitation email.')
->action(
function($teamId, $email, $name, $roles, $redirect) use ($request, $response, $register, $project, $user, $audit, $projectDB)
{
@ -405,7 +405,7 @@ $utopia->post('/v1/teams/:teamId/memberships/:inviteId/resend')
->label('sdk.description', 'Use this endpoint to resend your invitation email for a user to join a team.')
->param('teamId', '', function () {return new UID();}, 'Team unique ID.')
->param('inviteId', '', function () {return new UID();}, 'Invite unique ID.')
->param('redirect', '', function () use ($project) {return new Host($project->getAttribute('clients', []));}, 'Reset page to redirect user back to your app from the invitation email.')
->param('redirect', '', function () use ($clients) {return new Host($clients);}, 'Reset page to redirect user back to your app from the invitation email.')
->action(
function($teamId, $inviteId, $redirect) use ($response, $register, $project, $user, $audit, $projectDB)
{
@ -490,8 +490,8 @@ $utopia->patch('/v1/teams/:teamId/memberships/:inviteId/status')
->param('inviteId', '', function () {return new UID();}, 'Invite unique ID')
->param('userId', '', function () {return new UID();}, 'User unique ID')
->param('secret', '', function () {return new Text(256);}, 'Secret Key')
->param('success', null, function () use ($project) {return new Host($project->getAttribute('clients', []));}, 'Redirect when registration succeed', true)
->param('failure', null, function () use ($project) {return new Host($project->getAttribute('clients', []));}, 'Redirect when registration failed', 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)
->action(
function($teamId, $inviteId, $userId, $secret, $success, $failure) use ($response, $request, $user, $audit, $projectDB)
{

View file

@ -18,9 +18,10 @@ $providers = $this->getParam('providers', []);
data-service="users.listUsers"
data-event="submit"
data-scope="sdk"
data-name="project-users" data-debug="1">
data-name="project-users">
<input type="hidden" name="orderType" value="ASC">
<input type="hidden" name="offset" value="0">
<input type="hidden" name="limit" value="5">
<input type="hidden" name="limit" value="25">
<div class="row responsive">
<div class="col span-10">
<input name="search" id="searchUsers" type="search" autocomplete="off" placeholder="Search" class="margin-bottom-no">
@ -31,12 +32,15 @@ $providers = $this->getParam('providers', []);
</div>
</form>
<hr class="margin-bottom" />
<div
data-service="users.listUsers"
data-event="load,user-create,user-update,user-delete"
data-param-search=""
data-param-limit="25"
data-param-offset="0"
data-param-order-type="ASC"
data-scope="sdk"
data-name="project-users">
@ -47,7 +51,6 @@ $providers = $this->getParam('providers', []);
</div>
<div data-ls-if="0 != {{project-users.sum}}" style="display: none;">
<div class="box margin-bottom">
<table class="vertical">
<thead>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,10 @@
window.ls.filter
.add('gravatar', function ($value, element) {
if(!$value) {
return '';
}
// MD5 (Message-Digest Algorithm) by WebToolkit
let MD5 = function(s){function L(k,d){return(k<<d)|(k>>>(32-d))}function K(G,k){let I,d,F,H,x;F=(G&2147483648);H=(k&2147483648);I=(G&1073741824);d=(k&1073741824);x=(G&1073741823)+(k&1073741823);if(I&d){return(x^2147483648^F^H)}if(I|d){if(x&1073741824){return(x^3221225472^F^H)}else{return(x^1073741824^F^H)}}else{return(x^F^H)}}function r(d,F,k){return(d&F)|((~d)&k)}function q(d,F,k){return(d&k)|(F&(~k))}function p(d,F,k){return(d^F^k)}function n(d,F,k){return(F^(d|(~k)))}function u(G,F,aa,Z,k,H,I){G=K(G,K(K(r(F,aa,Z),k),I));return K(L(G,H),F)}function f(G,F,aa,Z,k,H,I){G=K(G,K(K(q(F,aa,Z),k),I));return K(L(G,H),F)}function D(G,F,aa,Z,k,H,I){G=K(G,K(K(p(F,aa,Z),k),I));return K(L(G,H),F)}function t(G,F,aa,Z,k,H,I){G=K(G,K(K(n(F,aa,Z),k),I));return K(L(G,H),F)}function e(G){let Z;let F=G.length;let x=F+8;let k=(x-(x%64))/64;let I=(k+1)*16;let aa=Array(I-1);let d=0;let H=0;while(H<F){Z=(H-(H%4))/4;d=(H%4)*8;aa[Z]=(aa[Z]|(G.charCodeAt(H)<<d));H++}Z=(H-(H%4))/4;d=(H%4)*8;aa[Z]=aa[Z]|(128<<d);aa[I-2]=F<<3;aa[I-1]=F>>>29;return aa}function B(x){let k="",F="",G,d;for(d=0;d<=3;d++){G=(x>>>(d*8))&255;F="0"+G.toString(16);k=k+F.substr(F.length-2,2)}return k}function J(k){k=k.replace(/rn/g,"n");let d="";for(let F=0;F<k.length;F++){let x=k.charCodeAt(F);if(x<128){d+=String.fromCharCode(x)}else{if((x>127)&&(x<2048)){d+=String.fromCharCode((x>>6)|192);d+=String.fromCharCode((x&63)|128)}else{d+=String.fromCharCode((x>>12)|224);d+=String.fromCharCode(((x>>6)&63)|128);d+=String.fromCharCode((x&63)|128)}}}return d}let C=Array();let P,h,E,v,g,Y,X,W,V;let S=7,Q=12,N=17,M=22;let A=5,z=9,y=14,w=20;let o=4,m=11,l=16,j=23;let U=6,T=10,R=15,O=21;s=J(s);C=e(s);Y=1732584193;X=4023233417;W=2562383102;V=271733878;for(P=0;P<C.length;P+=16){h=Y;E=X;v=W;g=V;Y=u(Y,X,W,V,C[P+0],S,3614090360);V=u(V,Y,X,W,C[P+1],Q,3905402710);W=u(W,V,Y,X,C[P+2],N,606105819);X=u(X,W,V,Y,C[P+3],M,3250441966);Y=u(Y,X,W,V,C[P+4],S,4118548399);V=u(V,Y,X,W,C[P+5],Q,1200080426);W=u(W,V,Y,X,C[P+6],N,2821735955);X=u(X,W,V,Y,C[P+7],M,4249261313);Y=u(Y,X,W,V,C[P+8],S,1770035416);V=u(V,Y,X,W,C[P+9],Q,2336552879);W=u(W,V,Y,X,C[P+10],N,4294925233);X=u(X,W,V,Y,C[P+11],M,2304563134);Y=u(Y,X,W,V,C[P+12],S,1804603682);V=u(V,Y,X,W,C[P+13],Q,4254626195);W=u(W,V,Y,X,C[P+14],N,2792965006);X=u(X,W,V,Y,C[P+15],M,1236535329);Y=f(Y,X,W,V,C[P+1],A,4129170786);V=f(V,Y,X,W,C[P+6],z,3225465664);W=f(W,V,Y,X,C[P+11],y,643717713);X=f(X,W,V,Y,C[P+0],w,3921069994);Y=f(Y,X,W,V,C[P+5],A,3593408605);V=f(V,Y,X,W,C[P+10],z,38016083);W=f(W,V,Y,X,C[P+15],y,3634488961);X=f(X,W,V,Y,C[P+4],w,3889429448);Y=f(Y,X,W,V,C[P+9],A,568446438);V=f(V,Y,X,W,C[P+14],z,3275163606);W=f(W,V,Y,X,C[P+3],y,4107603335);X=f(X,W,V,Y,C[P+8],w,1163531501);Y=f(Y,X,W,V,C[P+13],A,2850285829);V=f(V,Y,X,W,C[P+2],z,4243563512);W=f(W,V,Y,X,C[P+7],y,1735328473);X=f(X,W,V,Y,C[P+12],w,2368359562);Y=D(Y,X,W,V,C[P+5],o,4294588738);V=D(V,Y,X,W,C[P+8],m,2272392833);W=D(W,V,Y,X,C[P+11],l,1839030562);X=D(X,W,V,Y,C[P+14],j,4259657740);Y=D(Y,X,W,V,C[P+1],o,2763975236);V=D(V,Y,X,W,C[P+4],m,1272893353);W=D(W,V,Y,X,C[P+7],l,4139469664);X=D(X,W,V,Y,C[P+10],j,3200236656);Y=D(Y,X,W,V,C[P+13],o,681279174);V=D(V,Y,X,W,C[P+0],m,3936430074);W=D(W,V,Y,X,C[P+3],l,3572445317);X=D(X,W,V,Y,C[P+6],j,76029189);Y=D(Y,X,W,V,C[P+9],o,3654602809);V=D(V,Y,X,W,C[P+12],m,3873151461);W=D(W,V,Y,X,C[P+15],l,530742520);X=D(X,W,V,Y,C[P+2],j,3299628645);Y=t(Y,X,W,V,C[P+0],U,4096336452);V=t(V,Y,X,W,C[P+7],T,1126891415);W=t(W,V,Y,X,C[P+14],R,2878612391);X=t(X,W,V,Y,C[P+5],O,4237533241);Y=t(Y,X,W,V,C[P+12],U,1700485571);V=t(V,Y,X,W,C[P+3],T,2399980690);W=t(W,V,Y,X,C[P+10],R,4293915773);X=t(X,W,V,Y,C[P+1],O,2240044497);Y=t(Y,X,W,V,C[P+8],U,1873313359);V=t(V,Y,X,W,C[P+15],T,4264355552);W=t(W,V,Y,X,C[P+6],R,2734768916);X=t(X,W,V,Y,C[P+13],O,1309151649);Y=t(Y,X,W,V,C[P+4],U,4149444226);V=t(V,Y,X,W,C[P+11],T,3174756917);W=t(W,V,Y,X,C[P+2],R,718787259);X=t(X,W,V,Y,C[P+9],O,3951481745);Y=K(Y,h);X=K(X,E);W=K(W,v);V=K(V,g)}let i=B(Y)+B(X)+B(W)+B(V);return i.toLowerCase()};
let size = element.dataset['size'] || 80;