Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JASWANTH A
Frontend
Commits
75ca2ea7
Commit
75ca2ea7
authored
2 weeks ago
by
JASWANTH A
Browse files
Options
Downloads
Patches
Plain Diff
some changes
parent
cd66c0f0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components2/AdminLogin2/AdminLogin4.jsx
+31
-32
31 additions, 32 deletions
src/components2/AdminLogin2/AdminLogin4.jsx
with
31 additions
and
32 deletions
src/components2/AdminLogin2/AdminLogin4.jsx
+
31
−
32
View file @
75ca2ea7
...
...
@@ -4,33 +4,35 @@ import { FiMail, FiEye, FiEyeOff } from "react-icons/fi";
const
loginImage
=
new
URL
(
"
/public/assets/login_img/loginadmin.svg
"
,
import
.
meta
.
url
).
href
;
export
default
function
AdminLogin
()
{
const
[
adminId
,
setAdminId
]
=
useState
(
""
);
const
[
email
,
setEmail
]
=
useState
(
""
);
const
[
password
,
setPassword
]
=
useState
(
""
);
const
[
showPassword
,
setShowPassword
]
=
useState
(
false
);
const
[
error
,
setError
]
=
useState
({
adminId
:
""
,
password
:
""
,
general
:
""
});
const
[
error
,
setError
]
=
useState
({
email
:
""
,
password
:
""
,
general
:
""
});
const
validateMerchantId
=
(
id
)
=>
/^
[
A-Z
]{4}[
0-9
]{5}
$/
.
test
(
id
);
// Email validation regex
const
validateEmail
=
(
email
)
=>
/^
[
a-zA-Z0-9._%+-
]
+@
[
a-zA-Z0-9.-
]
+
\.[
a-zA-Z
]{2,}
$/
.
test
(
email
);
// Password validation (minimum 8 characters)
const
validatePassword
=
(
pass
)
=>
pass
.
length
>=
8
;
const
handleSubmit
=
(
e
)
=>
{
e
.
preventDefault
();
let
newErrors
=
{
adminId
:
""
,
password
:
""
,
general
:
""
};
let
newErrors
=
{
email
:
""
,
password
:
""
,
general
:
""
};
if
(
!
validate
MerchantId
(
adminId
))
{
newErrors
.
adminId
=
"
Merchant ID must be 4 uppercase letters followed by 5 digits
.
"
;
if
(
!
validate
Email
(
email
))
{
newErrors
.
email
=
"
Invalid email format
.
"
;
}
if
(
!
validatePassword
(
password
))
{
newErrors
.
password
=
"
Password must be at least 8 characters long.
"
;
}
if
(
newErrors
.
adminId
||
newErrors
.
password
)
{
newErrors
.
general
=
"
*Incorrect Email or Password
!
"
;
if
(
newErrors
.
email
||
newErrors
.
password
)
{
newErrors
.
general
=
"
*Incorrect Email or Password!
"
;
setError
(
newErrors
);
return
;
}
setError
({
adminId
:
""
,
password
:
""
,
general
:
""
});
setError
({
email
:
""
,
password
:
""
,
general
:
""
});
alert
(
"
Login Successful!
"
);
};
...
...
@@ -40,41 +42,38 @@ export default function AdminLogin() {
OMPOI - Admin
</
h1
>
<
div
className
=
"bg-[#
1E1E1
E] p-6 rounded-lg shadow-lg w-[90%] h-[90%] flex flex-col md:flex-row py-12"
>
<
div
className
=
"bg-[#
2E2E2
E] p-6 rounded-lg shadow-lg w-[90%] h-[90%] flex flex-col md:flex-row py-12"
>
<
div
className
=
"hidden md:flex w-1/2 items-center justify-center p-4 min-w-[300px]"
>
<
img
src
=
{
loginImage
}
alt
=
"Login"
className
=
"w-[80%] lg:w-[80%] xl:w-[80%]"
/>
</
div
>
<
div
className
=
"w-[1px] bg-gray-600 hidden md:block"
></
div
>
<
div
className
=
"w-full md:w-1/2 flex flex-col items-center justify-start p-6 text-[#6FE7D1]"
>
<
div
className
=
"w-full md:w-1/2 flex flex-col items-center justify-start p-6 text-[#6FE7D1]
mt-12
"
>
<
h2
className
=
"text-3xl md:text-3xl font-font-primary font-semibold text-[#6FE7D1] mb-6"
>
Admin Login
</
h2
>
<
form
onSubmit
=
{
handleSubmit
}
className
=
"w- max-w-md"
>
<
form
onSubmit
=
{
handleSubmit
}
className
=
"w- max-w-md"
>
<
div
className
=
"relative mt-6"
>
<
label
className
=
{
`absolute -top-3 left-4 px-2 bg-[#
1E1E1
E] border rounded-md text-sm font-font-primary font-medium
${
error
.
adminId
?
"
border-[#EEAB4D] text-[#EEAB4D]
"
:
"
border-[#6FE7D1] text-[#6FE7D1]
"
}
`
}
>
Admin ID
<
label
className
=
{
`absolute -top-3 left-4 px-2 bg-[#
2E2E2
E] border rounded-md text-sm font-font-primary font-medium
${
error
.
email
?
"
border-[#EEAB4D] text-[#EEAB4D]
"
:
"
border-[#6FE7D1] text-[#6FE7D1]
"
}
`
}
>
Email
</
label
>
<
input
type
=
"text"
value
=
{
adminId
}
onChange
=
{
(
e
)
=>
set
AdminId
(
e
.
target
.
value
)
}
placeholder
=
"Enter
ID
"
value
=
{
email
}
onChange
=
{
(
e
)
=>
set
Email
(
e
.
target
.
value
)
}
placeholder
=
"Enter
email
"
className
=
{
`w-96 h-16 px-6 pr-10 border-2 rounded-lg bg-transparent text-white text-lg shadow-sm focus:outline-none font-font-primary
${
error
.
adminId
?
"
border-[#EEAB4D] text-[#EEAB4D]
"
:
"
border-[#6FE7D1] text-white
"
}
`
}
${
error
.
email
?
"
border-[#EEAB4D] text-[#EEAB4D]
"
:
"
border-[#6FE7D1] text-white
"
}
`
}
/>
<
FiMail
className
=
"absolute right-4 top-1/2 transform -translate-y-1/2 text-xl transition-colors duration-200"
style
=
{
{
color
:
error
.
adminId
?
"
#EEAB4D
"
:
"
#6FE7D1
"
}
}
style
=
{
{
color
:
error
.
email
?
"
#EEAB4D
"
:
"
#6FE7D1
"
}
}
/>
</
div
>
<
div
className
=
"relative mt-12"
>
<
label
className
=
{
`absolute -top-3 left-4 px-2 bg-[#
1E1E1
E] border rounded-md text-sm font-font-primary font-medium
<
label
className
=
{
`absolute -top-3 left-4 px-2 bg-[#
2E2E2
E] border rounded-md text-sm font-font-primary font-medium
${
error
.
password
?
"
border-[#EEAB4D] text-[#EEAB4D]
"
:
"
border-[#6FE7D1] text-[#6FE7D1]
"
}
`
}
>
Password
</
label
>
...
...
@@ -105,7 +104,7 @@ export default function AdminLogin() {
Forgot Password?
</
a
>
{
error
.
general
&&
(
<
span
className
=
"text-[#EEAB4D] text-sm font-semibold
font-font-primary
font-font-primary
"
>
<
span
className
=
"text-[#EEAB4D] text-sm font-semibold font-font-primary"
>
{
error
.
general
}
</
span
>
)
}
...
...
@@ -117,9 +116,9 @@ export default function AdminLogin() {
Sign In
</
button
>
</
div
>
</
form
>
</
div
>
</
div
>
</
div
>
)};
\ No newline at end of file
</
form
>
</
div
>
</
div
>
</
div
>
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment