Skip to content

Commit

Permalink
Implement workaroud for password reset (#516)
Browse files Browse the repository at this point in the history
* Add redirect page for password reset

* Allow access to redirect page, center button
  • Loading branch information
VictiniX888 authored Nov 2, 2023
1 parent a9d93b3 commit 7745060
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/sso/components/routeGuard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function RouteGuard({ children }) {
'/reset',
'/reset#',
'/reset-email',
'/reset-redirect',
];

const path = url.split('?')[0];
Expand Down
1 change: 1 addition & 0 deletions apps/sso/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const REGISTERED_PATHS = new Set([
'login',
'reset',
'reset-email',
'reset-redirect',
'signup',
'verify',
'logout',
Expand Down
42 changes: 42 additions & 0 deletions apps/sso/pages/reset-redirect/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import styled from 'styled-components';
import Head from 'next/head';
import { getWebTitle } from '@hibiscus/metadata';
import { useRouter } from 'next/router';
import { useMemo } from 'react';
import { Button } from '@hibiscus/ui-kit-2023';

export function Index() {
const router = useRouter();

// Extract redirect url from the query params
// This is required due to https://github.com/supabase/gotrue/issues/713
const redirect = useMemo(() => router?.query?.url?.toString(), [router]);

return (
<MainPageWrapper>
<Head>
<title>{getWebTitle('Reset your password')}</title>
</Head>

<CenterDiv>
{redirect && (
<a href={redirect}>
<Button color="black">Click here to reset your password</Button>
</a>
)}
</CenterDiv>
</MainPageWrapper>
);
}
export default Index;

const MainPageWrapper = styled.div`
display: flex;
flex-direction: column;
justify-content: space-between;
min-height: 100vh;
`;

const CenterDiv = styled.div`
margin: auto;
`;

7 comments on commit 7745060

@vercel
Copy link

@vercel vercel bot commented on 7745060 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

interim – ./

socalhacks.org
interim-hacksc.vercel.app
interim-git-main-hacksc.vercel.app
www.socalhacks.org

@vercel
Copy link

@vercel vercel bot commented on 7745060 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 7745060 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 7745060 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sso – ./

sso-steel.vercel.app
sso-hacksc.vercel.app
sso-git-main-hacksc.vercel.app
sso.hacksc.com

@vercel
Copy link

@vercel vercel bot commented on 7745060 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

recruitment – ./

recruitment-hacksc.vercel.app
recruitment-git-main-hacksc.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 7745060 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

pointr – ./

pointr-git-main-hacksc.vercel.app
pointr.vercel.app
pointr-hacksc.vercel.app
www.hack.sc

@vercel
Copy link

@vercel vercel bot commented on 7745060 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

www-2023 – ./

www-2023.vercel.app
www-2023-git-main-hacksc.vercel.app
www-2023-hacksc.vercel.app
2023.hacksc.com

Please sign in to comment.