Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tia-dev
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dida Adams Arizona
Tia-dev
Commits
42e2449f
Commit
42e2449f
authored
Aug 13, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'riri' into 'master'
Update Reset See merge request
!59
parents
0a5c464e
feba820b
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
194 deletions
+109
-194
index.js
src/api/index.js
+2
-0
Login.js
src/container/Login.js
+28
-19
CreateItemLaporan.js
...container/MasterData/formItemLaporan/CreateItemLaporan.js
+40
-169
ResetPassword.js
src/container/ResetPassword.js
+39
-6
No files found.
src/api/index.js
View file @
42e2449f
...
@@ -65,6 +65,7 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
...
@@ -65,6 +65,7 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
const
login
=
(
body
)
=>
api
.
post
(
'auth/login'
,
body
)
const
login
=
(
body
)
=>
api
.
post
(
'auth/login'
,
body
)
const
resetPassword
=
(
body
)
=>
api
.
post
(
'auth/reset_password'
,
body
)
const
resetPassword
=
(
body
)
=>
api
.
post
(
'auth/reset_password'
,
body
)
const
verification
=
(
body
)
=>
api
.
post
(
'email/reset_password'
,
body
)
const
verification
=
(
body
)
=>
api
.
post
(
'email/reset_password'
,
body
)
const
isResetPassword
=
(
userId
)
=>
api
.
post
(
`auth/is_reset_password/
${
userId
}
`
)
//Role
//Role
const
getRole
=
()
=>
api
.
get
(
'role/get_all_role'
)
const
getRole
=
()
=>
api
.
get
(
'role/get_all_role'
)
...
@@ -104,6 +105,7 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
...
@@ -104,6 +105,7 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
login
,
login
,
verification
,
verification
,
resetPassword
,
resetPassword
,
isResetPassword
,
getRole
,
getRole
,
getDetailRole
,
getDetailRole
,
searchRole
,
searchRole
,
...
...
src/container/Login.js
View file @
42e2449f
...
@@ -22,12 +22,12 @@ class Login extends Component {
...
@@ -22,12 +22,12 @@ class Login extends Component {
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
this
.
state
=
{
this
.
state
=
{
username
:
''
,
email
:
''
,
password
:
''
,
password
:
''
,
showPass
:
false
,
showPass
:
false
,
error
Username
:
false
,
error
Email
:
false
,
errorPassword
:
false
,
errorPassword
:
false
,
msg
Username
:
''
,
msg
Email
:
''
,
msgPassword
:
''
msgPassword
:
''
}
}
}
}
...
@@ -39,16 +39,25 @@ class Login extends Component {
...
@@ -39,16 +39,25 @@ class Login extends Component {
handleChange
(
e
)
{
handleChange
(
e
)
{
let
data
=
this
.
state
let
data
=
this
.
state
this
.
setState
({...
data
,
[
e
.
target
.
name
]
:
e
.
target
.
value
})
this
.
setState
({...
data
,
[
e
.
target
.
name
]
:
e
.
target
.
value
})
if
(
e
.
target
.
name
==
"
username
"
)
{
if
(
e
.
target
.
name
==
"
email
"
)
{
this
.
setState
({
error
Username
:
false
,
msgUsername
:
''
})
this
.
setState
({
error
Email
:
false
,
msgEmail
:
''
})
}
else
if
(
e
.
target
.
name
)
{
}
else
if
(
e
.
target
.
name
)
{
this
.
setState
({
errorPassword
:
false
,
msgPassword
:
''
})
this
.
setState
({
errorPassword
:
false
,
msgPassword
:
''
})
}
}
}
}
isEmail
(
email
)
{
const
re
=
/^
(([^
<>()
\[\]\\
.,;:
\s
@"
]
+
(\.[^
<>()
\[\]\\
.,;:
\s
@"
]
+
)
*
)
|
(
".+"
))
@
((\[[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\])
|
(([
a-zA-Z
\-
0-9
]
+
\.)
+
[
a-zA-Z
]{2,}))
$/
;
return
re
.
test
(
String
(
email
).
toLowerCase
());
}
validateLogin
()
{
validateLogin
()
{
if
(
this
.
state
.
username
.
trim
()
==
""
)
{
var
isEmail
=
this
.
isEmail
(
this
.
state
.
email
)
this
.
setState
({
errorUsername
:
true
,
msgUsername
:
'Username harus diisi!'
})
if
(
this
.
state
.
email
.
trim
()
==
""
)
{
this
.
setState
({
errorEmail
:
true
,
msgEmail
:
'Email harus diisi!'
})
}
else
if
(
!
isEmail
)
{
this
.
setState
({
errorEmail
:
true
,
msgEmail
:
'Format email tidak sesuai!'
})
}
else
if
(
this
.
state
.
password
.
trim
()
==
""
)
{
}
else
if
(
this
.
state
.
password
.
trim
()
==
""
)
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'Password harus diisi!'
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'Password harus diisi!'
})
}
else
{
}
else
{
...
@@ -58,7 +67,7 @@ class Login extends Component {
...
@@ -58,7 +67,7 @@ class Login extends Component {
login
()
{
login
()
{
let
payload
=
{
let
payload
=
{
"
username"
:
this
.
state
.
username
,
"
email"
:
this
.
state
.
email
,
"password"
:
this
.
state
.
password
"password"
:
this
.
state
.
password
}
}
api
.
create
().
login
(
payload
).
then
((
response
)
=>
{
api
.
create
().
login
(
payload
).
then
((
response
)
=>
{
...
@@ -69,7 +78,7 @@ class Login extends Component {
...
@@ -69,7 +78,7 @@ class Login extends Component {
if
(
response
.
data
.
message
==
'Password Salah!'
)
{
if
(
response
.
data
.
message
==
'Password Salah!'
)
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
response
.
data
.
message
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
response
.
data
.
message
})
}
else
{
}
else
{
this
.
setState
({
error
Username
:
true
,
msgUsername
:
response
.
data
.
message
})
this
.
setState
({
error
Email
:
true
,
msgEmail
:
response
.
data
.
message
})
}
}
}
}
})
})
...
@@ -87,18 +96,18 @@ class Login extends Component {
...
@@ -87,18 +96,18 @@ class Login extends Component {
<
img
src
=
{
Images
.
tia
}
/
>
<
img
src
=
{
Images
.
tia
}
/
>
<
TextField
<
TextField
label
=
{
<
Typography
style
=
{{
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Username
/
Email
*<
/Typography>
}
label
=
{
<
Typography
style
=
{{
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Email
*<
/Typography>
}
id
=
"
username
"
id
=
"
email
"
type
=
{
"text"
}
type
=
{
"text"
}
name
=
{
"
username
"
}
name
=
{
"
email
"
}
value
=
{
this
.
state
.
username
}
value
=
{
this
.
state
.
email
}
onChange
=
{(
username
)
=>
{
onChange
=
{(
email
)
=>
{
this
.
handleChange
(
username
)
this
.
handleChange
(
email
)
}}
}}
variant
=
"outlined"
variant
=
"outlined"
error
=
{
this
.
state
.
error
Username
}
error
=
{
this
.
state
.
error
Email
}
style
=
{{
width
:
'100%'
,
height
:
51
,
marginTop
:
32
,
fontSize
:
14
}}
style
=
{{
width
:
'100%'
,
height
:
51
,
marginTop
:
32
,
fontSize
:
14
}}
helperText
=
{
this
.
state
.
msg
Username
}
helperText
=
{
this
.
state
.
msg
Email
}
InputProps
=
{{
InputProps
=
{{
endAdornment
:
<
InputAdornment
position
=
"end"
><
img
src
=
{
Images
.
email
}
/></
InputAdornment
>
,
endAdornment
:
<
InputAdornment
position
=
"end"
><
img
src
=
{
Images
.
email
}
/></
InputAdornment
>
,
}}
}}
...
@@ -115,7 +124,7 @@ class Login extends Component {
...
@@ -115,7 +124,7 @@ class Login extends Component {
}}
}}
variant
=
"outlined"
variant
=
"outlined"
error
=
{
this
.
state
.
errorPassword
}
error
=
{
this
.
state
.
errorPassword
}
style
=
{{
width
:
'100%'
,
height
:
51
,
marginTop
:
this
.
state
.
error
Username
?
35
:
20
}}
style
=
{{
width
:
'100%'
,
height
:
51
,
marginTop
:
this
.
state
.
error
Email
?
35
:
20
}}
helperText
=
{
this
.
state
.
msgPassword
}
helperText
=
{
this
.
state
.
msgPassword
}
InputProps
=
{{
InputProps
=
{{
endAdornment
:
<
InputAdornment
position
=
"end"
>
endAdornment
:
<
InputAdornment
position
=
"end"
>
...
@@ -136,7 +145,7 @@ class Login extends Component {
...
@@ -136,7 +145,7 @@ class Login extends Component {
<
span
style
=
{{
color
:
'rgba(0, 0, 0, 0.5)'
,
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Remember
Me
<
/span
>
<
span
style
=
{{
color
:
'rgba(0, 0, 0, 0.5)'
,
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Remember
Me
<
/span
>
<
Link
to
=
{{
pathname
:
'/forgot-password'
}}
style
=
{{
textDecoration
:
'none'
}}
><
span
style
=
{{
marginLeft
:
30
,
color
:
'#51c6ea'
,
cursor
:
'pointer'
,
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Lupa
Kata
Sandi
?
<
/span></
Link
>
<
Link
to
=
{{
pathname
:
'/forgot-password'
}}
style
=
{{
textDecoration
:
'none'
}}
><
span
style
=
{{
marginLeft
:
30
,
color
:
'#51c6ea'
,
cursor
:
'pointer'
,
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Lupa
Kata
Sandi
?
<
/span></
Link
>
<
/div
>
<
/div
>
<
Button
name
=
"submit"
variant
=
"contained"
disabled
=
{
this
.
state
.
username
.
trim
()
==
''
&&
this
.
state
.
password
.
trim
()
==
''
?
true
:
false
}
onClick
=
{()
=>
this
.
validateLogin
()}
style
=
{{
marginTop
:
23
,
width
:
'100%'
,
height
:
35
,
borderRadius
:
4
,
color
:
this
.
state
.
username
.
trim
()
==
''
&&
this
.
state
.
password
.
trim
()
==
''
?
'#4b4b4b'
:
'#fff'
,
backgroundColor
:
this
.
state
.
username
.
trim
()
==
''
&&
this
.
state
.
password
.
trim
()
==
''
?
'#d8d8d8'
:
'#51c6ea'
}}
>
<
Button
name
=
"submit"
variant
=
"contained"
disabled
=
{
this
.
state
.
email
.
trim
()
==
''
&&
this
.
state
.
password
.
trim
()
==
''
?
true
:
false
}
onClick
=
{()
=>
this
.
validateLogin
()}
style
=
{{
marginTop
:
23
,
width
:
'100%'
,
height
:
35
,
borderRadius
:
4
,
color
:
this
.
state
.
email
.
trim
()
==
''
&&
this
.
state
.
password
.
trim
()
==
''
?
'#4b4b4b'
:
'#fff'
,
backgroundColor
:
this
.
state
.
email
.
trim
()
==
''
&&
this
.
state
.
password
.
trim
()
==
''
?
'#d8d8d8'
:
'#51c6ea'
}}
>
<
Typography
style
=
{{
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Login
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Login
<
/Typography
>
<
/Button
>
<
/Button
>
<
/div
>
<
/div
>
...
...
src/container/MasterData/formItemLaporan/CreateItemLaporan.js
View file @
42e2449f
This diff is collapsed.
Click to expand it.
src/container/ResetPassword.js
View file @
42e2449f
...
@@ -26,18 +26,51 @@ class ResetPassword extends Component {
...
@@ -26,18 +26,51 @@ class ResetPassword extends Component {
console
.
log
(
this
.
props
.
match
.
params
.
id
)
console
.
log
(
this
.
props
.
match
.
params
.
id
)
let
userId
=
this
.
props
.
match
.
params
.
id
let
userId
=
this
.
props
.
match
.
params
.
id
this
.
setState
({
userId
})
this
.
setState
({
userId
})
this
.
checkExpiredLink
(
userId
)
// console.log(this.props)
// console.log(this.props)
}
}
checkExpiredLink
(
userId
)
{
api
.
create
().
isResetPassword
(
userId
).
then
((
response
)
=>
{
if
(
response
.
data
.
status
==
'success'
)
{
//
}
else
{
alert
(
response
.
data
.
message
)
this
.
props
.
history
.
push
(
'/login'
)
}
})
}
isRegex
(
value
)
{
// const re = /^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$/;
const
re
=
/^
(?=
.*
[
A-Za-z
])(?=
.*
\d)(?=
.*
[
@$!%*#?&
])[
A-Za-z
\d
@$!%*#?&
]{1,}
$/
;
return
re
.
test
(
String
(
value
));
}
isEmail
(
email
)
{
const
re
=
/^
(([^
<>()
\[\]\\
.,;:
\s
@"
]
+
(\.[^
<>()
\[\]\\
.,;:
\s
@"
]
+
)
*
)
|
(
".+"
))
@
((\[[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\])
|
(([
a-zA-Z
\-
0-9
]
+
\.)
+
[
a-zA-Z
]{2,}))
$/
;
return
re
.
test
(
String
(
email
).
toLowerCase
());
}
validateReset
()
{
validateReset
()
{
if
(
this
.
state
.
password
.
trim
()
==
""
)
{
if
(
this
.
state
.
password
.
trim
()
==
""
)
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'
Password
harus diisi!'
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'
Kata sandi
harus diisi!'
})
}
else
if
(
this
.
state
.
password
.
length
<
8
)
{
}
else
if
(
this
.
state
.
password
.
length
<
8
)
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'Password minimal 8 karakter!'
})
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'Kata sandi minimal 8 karakter!'
})
}
else
if
(
this
.
isEmail
(
this
.
state
.
password
))
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'Format kata sandi tidak boleh menggunakan email!'
})
}
else
if
(
!
this
.
isRegex
(
this
.
state
.
password
))
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'Kata sandi harus berupa kombinasi karakter, huruf dan angka!'
})
}
else
if
(
this
.
state
.
confirmPassword
.
trim
()
==
""
)
{
}
else
if
(
this
.
state
.
confirmPassword
.
trim
()
==
""
)
{
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'Konfirmasi
Password
harus diisi!'
})
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'Konfirmasi
kata sandi
harus diisi!'
})
}
else
if
(
this
.
state
.
confirmPassword
.
length
<
8
)
{
}
else
if
(
this
.
state
.
confirmPassword
.
length
<
8
)
{
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'Konfirmasi Password minimal 8 karakter!'
})
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'Konfirmasi kata sandi minimal 8 karakter!'
})
}
else
if
(
this
.
isEmail
(
this
.
state
.
confirmPassword
))
{
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'Format konfirmasi kata sandi tidak boleh menggunakan email!'
})
}
else
if
(
!
this
.
isRegex
(
this
.
state
.
confirmPassword
))
{
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'Konfirmasi kata sandi harus berupa kombinasi karakter, huruf dan angka!'
})
}
else
if
(
this
.
state
.
password
!==
this
.
state
.
confirmPassword
)
{
this
.
setState
({
errorConfirmPassword
:
true
,
msgConfirmPassword
:
'Konfirmasi kata sandi harus sama dengan kata sandi!'
})
}
else
{
}
else
{
this
.
confirmPassword
()
this
.
confirmPassword
()
}
}
...
@@ -113,7 +146,7 @@ class ResetPassword extends Component {
...
@@ -113,7 +146,7 @@ class ResetPassword extends Component {
}}
}}
variant
=
"outlined"
variant
=
"outlined"
error
=
{
this
.
state
.
errorConfirmPassword
}
error
=
{
this
.
state
.
errorConfirmPassword
}
style
=
{{
width
:
250
,
height
:
51
,
marginTop
:
4
0
}}
style
=
{{
width
:
250
,
height
:
51
,
marginTop
:
4
5
}}
helperText
=
{
<
Typography
style
=
{{
fontSize
:
9
,
marginTop
:
4
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
{
this
.
state
.
msgConfirmPassword
}
<
/Typography>
}
helperText
=
{
<
Typography
style
=
{{
fontSize
:
9
,
marginTop
:
4
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
{
this
.
state
.
msgConfirmPassword
}
<
/Typography>
}
InputProps
=
{{
InputProps
=
{{
endAdornment
:
<
InputAdornment
position
=
"end"
>
endAdornment
:
<
InputAdornment
position
=
"end"
>
...
@@ -129,7 +162,7 @@ class ResetPassword extends Component {
...
@@ -129,7 +162,7 @@ class ResetPassword extends Component {
}}
}}
/
>
/
>
<
Button
name
=
"submit"
variant
=
"contained"
disabled
=
{
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
true
:
false
}
onClick
=
{()
=>
this
.
validateReset
()}
style
=
{{
marginTop
:
4
0
,
width
:
'100%'
,
height
:
35
,
borderRadius
:
4
,
color
:
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
'#4b4b4b'
:
'#fff'
,
backgroundColor
:
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
'#d8d8d8'
:
'#51c6ea'
}}
>
<
Button
name
=
"submit"
variant
=
"contained"
disabled
=
{
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
true
:
false
}
onClick
=
{()
=>
this
.
validateReset
()}
style
=
{{
marginTop
:
5
0
,
width
:
'100%'
,
height
:
35
,
borderRadius
:
4
,
color
:
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
'#4b4b4b'
:
'#fff'
,
backgroundColor
:
this
.
state
.
password
.
trim
()
==
''
&&
this
.
state
.
confirmPassword
.
trim
()
==
''
?
'#d8d8d8'
:
'#51c6ea'
}}
>
<
Typography
style
=
{{
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Lanjut
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Lanjut
<
/Typography
>
<
/Button
>
<
/Button
>
<
/div
>
<
/div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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