Skip to content

Commit

Permalink
adding reset password
Browse files Browse the repository at this point in the history
reset password, new home page, little changes
  • Loading branch information
Anas-github-acc authored Jul 29, 2024
1 parent 9fe3615 commit fd608db
Show file tree
Hide file tree
Showing 20 changed files with 914 additions and 20 deletions.
160 changes: 159 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@emotion/styled": "^11.12.0",
"@mui/material": "^5.16.4",
"@radix-ui/react-avatar": "^1.1.0",
"@radix-ui/react-checkbox": "^1.1.1",
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-icons": "^1.3.0",
Expand Down
Binary file added public/home/homebg.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/home/placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions src/app/api/update-password/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {NextRequest, NextResponse} from "next/server";
import { cookies } from 'next/headers';
import {createClient} from "@/utils/supabase/server";

export async function GET(req: NextRequest) {
const requestUrl = new URL(req.nextUrl.href)
const code = requestUrl.searchParams.get('code')

if( code ) {
const supabase = createClient()
const { error } = await supabase.auth.exchangeCodeForSession(code)

return NextResponse.redirect(new URL(`${req.nextUrl.origin}/auth/update_password`, req.nextUrl.href))
}

console.log({error : 'ERROR: Invalid auth code or no auth code found'}, { status: 500 })

return NextResponse.redirect(new URL(`${req.nextUrl.origin}/auth`, req.nextUrl.href))
}
23 changes: 23 additions & 0 deletions src/app/auth/component/component.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React, { FormEvent, use, useEffect, useState } from "react";
import Link from "next/link";
import axios from "axios";

import { Label } from "@/components/ui/label"
import { Input } from "@/components/ui/input"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import Loader from '@/components/ui/loader'

import { VscEye, VscEyeClosed } from "react-icons/vsc"
Expand Down Expand Up @@ -165,6 +167,27 @@ export function Component( props : Props) {
<i className={`${!(input.name === 'password') && 'hidden'} ${styles.inputicon} ${styles.eyeicon}`} onClick={() => setRevealPassword(!revealPassword)}>{revealPassword?<VscEyeClosed size='23px'/>:<VscEye size='23px'/>}</i>
</div>
))}

{auth === 'login' &&
<div className="flex items-center justify-between">
<div className="flex items-center">
<Checkbox
id="remember-me"
name="remember-me"
className="h-4 w-4 rounded text-primary focus:ring-primary"
checked
disabled
/>
<Label htmlFor="remember-me" className="ml-2 block text-sm text-foreground">
Remember me
</Label>
</div>
<div className="text-sm">
<Link href="auth/reset_password" className="font-medium text-primary hover:text-primary/80" prefetch={false}>
Forgot your password?
</Link>
</div>
</div>}
<div>
<Button
type="submit"
Expand Down
5 changes: 5 additions & 0 deletions src/app/auth/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ export default function Auth(){
</div>)}

{oauthhidden && <OAuthComponent onClick={Authsignin} />}
<div className="text-center text-sm text-muted-foreground">
<Link href="/home" className="font-medium hover:underline" prefetch={false}>
Back to Home
</Link>
</div>
</Component>
</Suspense>
)
Expand Down
Loading

1 comment on commit fd608db

@github-actions
Copy link

Choose a reason for hiding this comment

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

Deploy preview for iiitvcc ready!

✅ Preview
https://iiitvcc-gzoz1tsez-iiitv-coding-clubs-projects.vercel.app

Built with commit fd608db.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.