-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1872347
commit 6789d2f
Showing
14 changed files
with
239 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} | ||
"extends": ["next/core-web-vitals"], | ||
"rules": { | ||
"@next/next/no-img-element": "off" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { NextResponse } from "next/server"; | ||
import { signup } from 'email-armor' | ||
import { cookies } from 'next/headers' | ||
|
||
console.clear(); | ||
|
||
export async function POST(request) { | ||
|
||
const { userFullName, userName, userEmail, userPassword, userReferredBy, userAgent, userIP } = await request.json(); | ||
|
||
const signUpUser = await signup(userFullName, userName, userEmail, userPassword, userReferredBy, userAgent, userIP); | ||
|
||
// cookies().set('id', signInUser.id); | ||
// cookies().set('userName', signInUser.userName); | ||
|
||
return NextResponse.json( | ||
{ | ||
statusCode: signUpUser.status, | ||
message: signUpUser.message | ||
}, | ||
{ status: 200 } | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,36 @@ | ||
'use client' | ||
import Link from "next/link" | ||
|
||
import axios from 'axios'; | ||
import React, { useState } from 'react' | ||
|
||
const ResetPassoword = () => { | ||
|
||
const [userName, setuserName] = useState('priyalcoc2'); | ||
const [otp, setotp] = useState(''); | ||
const [newPassword, setnewPassword] = useState(''); | ||
const [errorMessage, seterrorMessage] = useState(''); | ||
|
||
async function resendOTP() { | ||
const response = await axios.post('/api/resend', { userName, type: 'forgotPassword' }); | ||
|
||
const message = response.data.message; | ||
|
||
seterrorMessage(message); | ||
} | ||
|
||
async function resetPassowrd() { | ||
const response = await axios.post('/api/forgotPassword', { userName, otp, newPassword }); | ||
|
||
const message = response.data.message; | ||
const statusCode = response.data.statusCode; | ||
|
||
if (statusCode === 200) { | ||
|
||
seterrorMessage(message); | ||
setTimeout(() => { | ||
window.location.href = '/'; | ||
}, 2000); | ||
|
||
} else { | ||
seterrorMessage(message); | ||
} | ||
} | ||
|
||
const ForgotPasswordPage = () => { | ||
return ( | ||
<div className='flex flex-col gap-4 mt-4 ml-8'> | ||
<p><input value={userName} onChange={(e) => setuserName(e.target.value)} className='text-black pl-2 py-2 placeholder:text-black' placeholder='user name' type="text" /></p> | ||
<p><input value={otp} onChange={(e) => setotp(e.target.value)} className='text-black pl-2 py-2 placeholder:text-black' placeholder='otp' type="otp" /></p> | ||
<p><input value={newPassword} onChange={(e) => setnewPassword(e.target.value)} className='text-black pl-2 py-2 placeholder:text-black' placeholder='newPassword' type="newPassword" /></p> | ||
{errorMessage && <p className='text-red-600'>{errorMessage}</p>} | ||
<button onClick={resendOTP} className="text-left cursor-pointer">resendOTP</button> | ||
<button onClick={resetPassowrd} className="text-left cursor-pointer">submit</button> | ||
</div> | ||
<> | ||
<section className="bg-gray-50 dark:bg-gray-900"> | ||
<div className="flex flex-col items-center justify-center px-6 py-8 mx-auto md:h-screen lg:py-0"> | ||
<div className="w-full bg-white rounded-lg shadow dark:border md:mt-0 sm:max-w-md xl:p-0 dark:bg-gray-800 dark:border-gray-700"> | ||
<div className="p-6 space-y-4 md:space-y-6 sm:p-8"> | ||
<h1 className="text-xl font-bold leading-tight tracking-tight text-gray-900 md:text-2xl dark:text-white"> | ||
Create a new account | ||
</h1> | ||
<form className="space-y-4 md:space-y-6" action="#"> | ||
<div> | ||
<label htmlFor="email" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Your email</label> | ||
<input type="email" name="email" id="email" className="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="[email protected]" required="" /> | ||
</div> | ||
<div> | ||
<label htmlFor="password" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Password</label> | ||
<input type="password" name="password" id="password" placeholder="••••••••" className="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" required="" /> | ||
</div> | ||
<button type="submit" className="w-full text-white bg-primary-600 hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800">Sign up</button> | ||
<p className="text-sm font-light text-gray-500 dark:text-gray-400"> | ||
Already have an account? <Link href="/signIn" className="font-medium text-primary-600 hover:underline dark:text-primary-500">Sign In</Link> | ||
</p> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
</> | ||
) | ||
} | ||
|
||
export default ResetPassoword | ||
export default ForgotPasswordPage |
Oops, something went wrong.