Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alfina Megasiwi
Walkiddie Toys - FrontEnd
Commits
e6ed7577
Commit
e6ed7577
authored
Mar 30, 2021
by
Aji Inisti Udma Wijaya
Browse files
[GREEN] Implement Case when password to similar with username or email
parent
7f5d1ee0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/page/RegistrasiMitra/RegistrasiMitra.js
View file @
e6ed7577
...
...
@@ -26,18 +26,26 @@ const RegistrasiMitra = ({ signupMitra, isAuthenticated })=> {
if
(
password
===
re_password
)
{
const
res
=
await
signupMitra
(
first_name
,
last_name
,
email
,
password
,
re_password
);
// console.log(res.signup)
if
(
res
.
signup
){
return
<
Redirect
to
=
'
/masuk
'
/>
}
else
{
alert
(
'
Email yang anda masukan telah terdaftar
'
)
if
(
check
(
first_name
,
password
)
||
check
(
last_name
,
password
)
||
check
(
email
,
password
)
||
check
(
password
,
first_name
)
||
check
(
password
,
last_name
)
||
check
(
password
,
email
)){
alert
(
'
Password yang anda masukan terlalu mirip dengan email maupun nama anda
'
)
}
else
{
if
(
res
.
signup
){
return
<
Redirect
to
=
'
/masuk
'
/>
}
else
{
alert
(
'
Email yang anda masukan telah terdaftar
'
)
}
}
}
else
{
alert
(
"
Password anda harus sama
"
)
}
};
function
check
(
use
,
pwd
){
return
pwd
.
match
(
/
[
a-z
]
+/ig
).
filter
(
a
=>
a
.
length
>
2
&&
use
.
includes
(
a
)).
length
>
0
?
true
:
false
;
}
if
(
isAuthenticated
)
{
return
<
Redirect
to
=
'
/
'
/>
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment