Added the ability for the user to show the password they're typing
This commit is contained in:
@@ -13,6 +13,7 @@ import Link from "next/link";
|
|||||||
export default function Login() {
|
export default function Login() {
|
||||||
const [email, setEmail] = useState("");
|
const [email, setEmail] = useState("");
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
const {mutateUser} = useUser({
|
const {mutateUser} = useUser({
|
||||||
@@ -71,15 +72,23 @@ export default function Login() {
|
|||||||
className="px-8 py-6 text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full shadow-xl shadow-mti-gray-anti-flash focus:outline-none"
|
className="px-8 py-6 text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full shadow-xl shadow-mti-gray-anti-flash focus:outline-none"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-3 w-full">
|
<div className="relative flex flex-col gap-3 w-full">
|
||||||
<label className="font-normal text-base text-mti-gray-dim">Password</label>
|
<label className="font-normal text-base text-mti-gray-dim">Password</label>
|
||||||
<input
|
<div className="w-full h-fit relative">
|
||||||
type="password"
|
<input
|
||||||
name="password"
|
type={showPassword ? "text" : "password"}
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
name="password"
|
||||||
placeholder="Password"
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
className="px-8 py-6 text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full shadow-xl shadow-mti-gray-anti-flash focus:outline-none"
|
placeholder="Password"
|
||||||
/>
|
className="w-full px-8 py-6 text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full shadow-xl shadow-mti-gray-anti-flash focus:outline-none"
|
||||||
|
/>
|
||||||
|
<p
|
||||||
|
role="button"
|
||||||
|
onClick={() => setShowPassword((prev) => !prev)}
|
||||||
|
className="text-xs cursor-pointer absolute bottom-1/2 translate-y-1/2 right-8">
|
||||||
|
{showPassword ? "Hide" : "Show"}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button className="mt-8 w-full" color="green" disabled={isLoading}>
|
<Button className="mt-8 w-full" color="green" disabled={isLoading}>
|
||||||
{!isLoading && "Login"}
|
{!isLoading && "Login"}
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ export default function Register() {
|
|||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
const [email, setEmail] = useState("");
|
const [email, setEmail] = useState("");
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
const [confirmPassword, setConfirmPassword] = useState("");
|
const [confirmPassword, setConfirmPassword] = useState("");
|
||||||
|
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
const {mutateUser} = useUser({
|
const {mutateUser} = useUser({
|
||||||
@@ -50,6 +52,7 @@ export default function Register() {
|
|||||||
<div className="flex flex-col gap-3 w-full">
|
<div className="flex flex-col gap-3 w-full">
|
||||||
<label className="font-normal text-base text-mti-gray-dim">Email address *</label>
|
<label className="font-normal text-base text-mti-gray-dim">Email address *</label>
|
||||||
<input
|
<input
|
||||||
|
required
|
||||||
type="email"
|
type="email"
|
||||||
name="email"
|
name="email"
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
@@ -57,25 +60,43 @@ export default function Register() {
|
|||||||
className="px-8 py-6 text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full shadow-xl shadow-mti-gray-anti-flash focus:outline-none"
|
className="px-8 py-6 text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full shadow-xl shadow-mti-gray-anti-flash focus:outline-none"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-3 w-full">
|
<div className="relative flex flex-col gap-3 w-full">
|
||||||
<label className="font-normal text-base text-mti-gray-dim">Password *</label>
|
<label className="font-normal text-base text-mti-gray-dim">Password</label>
|
||||||
<input
|
<div className="w-full h-fit relative">
|
||||||
type="password"
|
<input
|
||||||
name="password"
|
required
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
type={showPassword ? "text" : "password"}
|
||||||
placeholder="Enter your password"
|
name="password"
|
||||||
className="px-8 py-6 text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full shadow-xl shadow-mti-gray-anti-flash focus:outline-none"
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
/>
|
placeholder="Password"
|
||||||
|
className="w-full px-8 py-6 text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full shadow-xl shadow-mti-gray-anti-flash focus:outline-none"
|
||||||
|
/>
|
||||||
|
<p
|
||||||
|
role="button"
|
||||||
|
onClick={() => setShowPassword((prev) => !prev)}
|
||||||
|
className="text-xs cursor-pointer absolute bottom-1/2 translate-y-1/2 right-8">
|
||||||
|
{showPassword ? "Hide" : "Show"}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-3 w-full">
|
<div className="relative flex flex-col gap-3 w-full">
|
||||||
<label className="font-normal text-base text-mti-gray-dim">Confirm Password *</label>
|
<label className="font-normal text-base text-mti-gray-dim">Confirm Password *</label>
|
||||||
<input
|
<div className="w-full h-fit relative">
|
||||||
type="password"
|
<input
|
||||||
name="confirmPassword"
|
required
|
||||||
onChange={(e) => setConfirmPassword(e.target.value)}
|
type={showConfirmPassword ? "text" : "password"}
|
||||||
placeholder="Confirm your password"
|
name="confirmPassword"
|
||||||
className="px-8 py-6 text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full shadow-xl shadow-mti-gray-anti-flash focus:outline-none"
|
onChange={(e) => setConfirmPassword(e.target.value)}
|
||||||
/>
|
placeholder="Confirm your password"
|
||||||
|
className="w-full px-8 py-6 text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full shadow-xl shadow-mti-gray-anti-flash focus:outline-none"
|
||||||
|
/>
|
||||||
|
<p
|
||||||
|
role="button"
|
||||||
|
onClick={() => setShowConfirmPassword((prev) => !prev)}
|
||||||
|
className="text-xs cursor-pointer absolute bottom-1/2 translate-y-1/2 right-8">
|
||||||
|
{showConfirmPassword ? "Hide" : "Show"}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button className="mt-8 w-full" color="green" disabled={isLoading}>
|
<Button className="mt-8 w-full" color="green" disabled={isLoading}>
|
||||||
{!isLoading && "Create account"}
|
{!isLoading && "Create account"}
|
||||||
|
|||||||
Reference in New Issue
Block a user