feat(chalice): remove signup endpoint if tenant exists

This commit is contained in:
Taha Yassine Kraiem 2023-03-27 11:59:29 +01:00
parent 8530f7c100
commit 07aeff5ab1
3 changed files with 16 additions and 8 deletions

View file

@ -663,12 +663,6 @@ async def mobile_signe(projectId: int, sessionId: int, data: schemas.MobileSignP
return {"data": mobile.sign_keys(project_id=projectId, session_id=sessionId, keys=data.keys)}
@public_app.post('/signup', tags=['signup'])
@public_app.put('/signup', tags=['signup'])
async def signup_handler(data: schemas.UserSignupSchema = Body(...)):
return signup.create_step1(data)
@app.post('/projects', tags=['projects'])
async def create_project(data: schemas.CreateProjectSchema = Body(...),
context: schemas.CurrentContext = Depends(OR_context)):

View file

@ -6,7 +6,7 @@ from starlette.responses import RedirectResponse, FileResponse
import schemas
from chalicelib.core import sessions, errors, errors_viewed, errors_favorite, sessions_assignments, heatmaps, \
sessions_favorite, assist, sessions_notes, click_maps, sessions_replay
sessions_favorite, assist, sessions_notes, click_maps, sessions_replay, signup
from chalicelib.core import sessions_viewed
from chalicelib.core import tenants, users, projects, license
from chalicelib.core import webhook
@ -27,6 +27,13 @@ async def get_all_signup():
"edition": license.EDITION}}
if not tenants.tenants_exists(use_pool=False):
@public_app.post('/signup', tags=['signup'])
@public_app.put('/signup', tags=['signup'])
async def signup_handler(data: schemas.UserSignupSchema = Body(...)):
return signup.create_step1(data)
@app.get('/account', tags=['accounts'])
async def get_account(context: schemas.CurrentContext = Depends(OR_context)):
r = users.get(tenant_id=context.tenant_id, user_id=context.user_id)

View file

@ -7,7 +7,7 @@ from starlette.responses import RedirectResponse, FileResponse
import schemas
import schemas_ee
from chalicelib.core import sessions, assist, heatmaps, sessions_favorite, sessions_assignments, errors, errors_viewed, \
errors_favorite, sessions_notes, click_maps, sessions_replay
errors_favorite, sessions_notes, click_maps, sessions_replay, signup
from chalicelib.core import sessions_viewed
from chalicelib.core import tenants, users, projects, license
from chalicelib.core import webhook
@ -31,6 +31,13 @@ async def get_all_signup():
"edition": license.EDITION}}
if not tenants.tenants_exists(use_pool=False):
@public_app.post('/signup', tags=['signup'])
@public_app.put('/signup', tags=['signup'])
async def signup_handler(data: schemas.UserSignupSchema = Body(...)):
return signup.create_step1(data)
@app.get('/account', tags=['accounts'])
async def get_account(context: schemas.CurrentContext = Depends(OR_context)):
r = users.get(tenant_id=context.tenant_id, user_id=context.user_id)