fix: signup remaining bugs

This commit is contained in:
swve 2024-01-25 23:49:29 +01:00
parent 0d775a0fe9
commit fdd21c2eda
4 changed files with 57 additions and 51 deletions

View file

@ -240,12 +240,14 @@ async def delete_invite_code(
)
# Delete invite code
invite_code = r.delete(f"{invite_code_uuid}:org:{org.org_uuid}:code:*")
keys = r.keys(f"{invite_code_uuid}:org:{org.org_uuid}:code:*")
if keys:
r.delete(*keys)
if not invite_code:
if not keys:
raise HTTPException(
status_code=404,
detail="Invite code not found",
)
return invite_code
return keys

View file

@ -12,7 +12,7 @@ export async function generateMetadata(
): Promise<Metadata> {
const orgslug = params.orgslug;
// Get Org context information
const org = await getOrganizationContextInfo(orgslug, { revalidate: 1800, tags: ['organizations'] });
const org = await getOrganizationContextInfo(orgslug, { revalidate: 0, tags: ['organizations'] });
return {
title: 'Login' + `${org.name}`,
@ -21,7 +21,7 @@ export async function generateMetadata(
const Login = async (params: any) => {
const orgslug = params.params.orgslug;
const org = await getOrganizationContextInfo(orgslug, { revalidate: 1800, tags: ['organizations'] });
const org = await getOrganizationContextInfo(orgslug, { revalidate: 0, tags: ['organizations'] });
return (
<div>

View file

@ -15,7 +15,7 @@ export async function generateMetadata(
): Promise<Metadata> {
const orgslug = params.orgslug;
// Get Org context information
const org = await getOrganizationContextInfo(orgslug, { revalidate: 1800, tags: ['organizations'] });
const org = await getOrganizationContextInfo(orgslug, { revalidate: 0, tags: ['organizations'] });
return {
title: 'Sign up' + `${org.name}`,
@ -24,7 +24,7 @@ export async function generateMetadata(
const SignUp = async (params: any) => {
const orgslug = params.params.orgslug;
const org = await getOrganizationContextInfo(orgslug, { revalidate: 1800, tags: ['organizations'] });
const org = await getOrganizationContextInfo(orgslug, { revalidate: 0, tags: ['organizations'] });
return (
<>

View file

@ -67,10 +67,14 @@ function SignUpClient(props : SignUpClientProps) {
</div>
</div>
<div className="left-join-part bg-white flex flex-row">
{joinMethod == 'open' && <OpenSignUpComponent />}
{joinMethod == 'inviteOnly' && inviteCode && session.isAuthenticated && <LoggedInJoinScreen />}
{joinMethod == 'inviteOnly' && inviteCode && !session.isAuthenticated && <InviteOnlySignUpComponent inviteCode={inviteCode} />}
{joinMethod == 'inviteOnly' && !inviteCode && <NoTokenScreen />}
{joinMethod == 'open' && (
session.isAuthenticated ? <LoggedInJoinScreen inviteCode={inviteCode} /> : <OpenSignUpComponent />
)}
{joinMethod == 'inviteOnly' && (
inviteCode ? (
session.isAuthenticated ? <LoggedInJoinScreen /> : <InviteOnlySignUpComponent inviteCode={inviteCode} />
) : <NoTokenScreen />
)}
</div>
</div>
)