fix: get invited by correctly
continuous-integration/drone/push Build is passing Details

This commit is contained in:
cellarspoon 2022-01-10 17:43:00 +01:00
parent a97a19d134
commit 83a02d69d4
No known key found for this signature in database
GPG Key ID: 03789458B3D0C410
2 changed files with 7 additions and 4 deletions

View File

@ -10,7 +10,7 @@ KEYCLOAK_DOMAIN=login.lumbung.space
KEYCLOAK_REALM=lumbung-space KEYCLOAK_REALM=lumbung-space
LETS_ENCRYPT_ENV=production LETS_ENCRYPT_ENV=production
NEXTCLOUD_API_BASE_URL=cloud.lumbung.space NEXTCLOUD_API_BASE_URL=cloud.lumbung.space
NEXTCLOUD_APP_PASSWORD=fizzbang NEXTCLOUD_APP_SECRET=fizzbang
NEXTCLOUD_USER=decentral1se NEXTCLOUD_USER=decentral1se
REDIS_DB=0 REDIS_DB=0
REDIS_HOST=localhost REDIS_HOST=localhost

View File

@ -18,13 +18,16 @@ async def register_invite(
): ):
from members_lumbung_space.config import INVITE_TIME_LIMIT from members_lumbung_space.config import INVITE_TIME_LIMIT
matching, username, matching_invite = False, None, None matching, invited_by, matching_invite = False, None, None
for username in invites: for username in invites:
for _invite in invites[username]: for _invite in invites[username]:
if invite == _invite["link"]: if invite == _invite["link"]:
matching = True matching = True
username = username invited_by = username
matching_invite = _invite matching_invite = _invite
break
if matching:
break
if not matching: if not matching:
message = "This invite does not exist, sorry." message = "This invite does not exist, sorry."
@ -45,7 +48,7 @@ async def register_invite(
"invalid.html", context=context "invalid.html", context=context
) )
context = {"request": request, "invited_by": username} context = {"request": request, "invited_by": invited_by}
return request.app.state.templates.TemplateResponse( return request.app.state.templates.TemplateResponse(
"register.html", context=context "register.html", context=context
) )