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
8a734896
Commit
8a734896
authored
Aug 11, 2020
by
Dida Adams Arizona
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'riri' into 'master'
login lagi See merge request
!41
parents
bc31197f
ba7e806e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
20 deletions
+57
-20
index.js
src/api/index.js
+2
-0
ForgotPassword.js
src/container/ForgotPassword.js
+14
-6
Login.js
src/container/Login.js
+41
-14
No files found.
src/api/index.js
View file @
8a734896
...
@@ -61,6 +61,7 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
...
@@ -61,6 +61,7 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
//
//
const
getRoot
=
()
=>
api
.
get
(
''
)
const
getRoot
=
()
=>
api
.
get
(
''
)
const
login
=
(
body
)
=>
api
.
post
(
'auth/login'
,
body
)
const
login
=
(
body
)
=>
api
.
post
(
'auth/login'
,
body
)
const
verification
=
(
body
)
=>
api
.
post
(
'email/reset_password'
,
body
)
//Role
//Role
const
getRole
=
()
=>
api
.
get
(
'role/get_all_role'
)
const
getRole
=
()
=>
api
.
get
(
'role/get_all_role'
)
...
@@ -83,6 +84,7 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
...
@@ -83,6 +84,7 @@ const create = (baseURL = 'https://trftia.eksad.com/tia-reporting-dev/public/')
// a list of the API functions from step 2
// a list of the API functions from step 2
getRoot
,
getRoot
,
login
,
login
,
verification
,
getRole
,
getRole
,
addRole
,
addRole
,
editRole
,
editRole
,
...
...
src/container/ForgotPassword.js
View file @
8a734896
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
Images
from
'../assets/Images'
;
import
Images
from
'../assets/Images'
;
import
{
TextField
,
InputAdornment
,
Button
,
Typography
}
from
'@material-ui/core'
;
import
{
TextField
,
InputAdornment
,
Button
,
Typography
}
from
'@material-ui/core'
;
import
api
from
'../api'
;
class
ForgotPassword
extends
Component
{
class
ForgotPassword
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
this
.
state
=
{
this
.
state
=
{
username
:
''
email
:
''
}
}
}
}
...
@@ -15,6 +16,13 @@ class ForgotPassword extends Component {
...
@@ -15,6 +16,13 @@ class ForgotPassword extends Component {
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
})
}
}
verification
()
{
let
payload
=
{
"email"
:
this
.
state
.
email
}
}
render
()
{
render
()
{
return
(
return
(
<
div
style
=
{{
flex
:
1
,
display
:
'flex'
,
backgroundColor
:
'#51c6ea'
,
height
:
'100vh'
,
justifyContent
:
'center'
,
alignItems
:
'center'
}}
>
<
div
style
=
{{
flex
:
1
,
display
:
'flex'
,
backgroundColor
:
'#51c6ea'
,
height
:
'100vh'
,
justifyContent
:
'center'
,
alignItems
:
'center'
}}
>
...
@@ -23,11 +31,11 @@ class ForgotPassword extends Component {
...
@@ -23,11 +31,11 @@ class ForgotPassword extends Component {
<
TextField
<
TextField
label
=
{
<
Typography
style
=
{{
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
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
)
=>
this
.
setState
({
username
:
username
.
target
.
value
})}
onChange
=
{(
email
)
=>
this
.
setState
({
email
:
email
.
target
.
value
})}
variant
=
"outlined"
variant
=
"outlined"
error
=
{
false
}
error
=
{
false
}
style
=
{{
width
:
250
,
height
:
51
,
marginTop
:
32
,
fontSize
:
14
}}
style
=
{{
width
:
250
,
height
:
51
,
marginTop
:
32
,
fontSize
:
14
}}
...
@@ -37,7 +45,7 @@ class ForgotPassword extends Component {
...
@@ -37,7 +45,7 @@ class ForgotPassword extends Component {
}}
}}
/
>
/
>
<
Button
variant
=
"contained"
style
=
{{
marginTop
:
23
,
width
:
250
,
height
:
30
,
borderRadius
:
4
}}
disabled
>
<
Button
variant
=
"contained"
style
=
{{
marginTop
:
23
,
width
:
250
,
height
:
30
,
borderRadius
:
4
,
backgroundColor
:
'#51c6ea'
,
color
:
'#ffffff'
}}
>
<
Typography
style
=
{{
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Lanjut
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Lanjut
<
/Typography
>
<
/Button
>
<
/Button
>
...
...
src/container/Login.js
View file @
8a734896
...
@@ -23,7 +23,11 @@ class Login extends Component {
...
@@ -23,7 +23,11 @@ class Login extends Component {
this
.
state
=
{
this
.
state
=
{
username
:
''
,
username
:
''
,
password
:
''
,
password
:
''
,
showPass
:
false
showPass
:
false
,
errorUsername
:
false
,
errorPassword
:
false
,
msgUsername
:
''
,
msgPassword
:
''
}
}
}
}
...
@@ -34,6 +38,21 @@ class Login extends Component {
...
@@ -34,6 +38,21 @@ 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"
)
{
this
.
setState
({
errorUsername
:
false
,
msgUsername
:
''
})
}
else
if
(
e
.
target
.
name
)
{
this
.
setState
({
errorPassword
:
false
,
msgPassword
:
''
})
}
}
validateLogin
()
{
if
(
this
.
state
.
username
.
trim
()
==
""
)
{
this
.
setState
({
errorUsername
:
true
,
msgUsername
:
'Username harus diisi!'
})
}
else
if
(
this
.
state
.
password
.
trim
()
==
""
)
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
'Password harus diisi!'
})
}
else
{
this
.
login
()
}
}
}
login
()
{
login
()
{
...
@@ -46,7 +65,11 @@ class Login extends Component {
...
@@ -46,7 +65,11 @@ class Login extends Component {
localStorage
.
setItem
(
Constant
.
TOKEN
,
response
.
data
.
data
.
token
)
localStorage
.
setItem
(
Constant
.
TOKEN
,
response
.
data
.
data
.
token
)
this
.
props
.
history
.
push
(
'/home/beranda'
)
this
.
props
.
history
.
push
(
'/home/beranda'
)
}
else
{
}
else
{
alert
(
response
.
data
.
message
)
if
(
response
.
data
.
message
==
'Password Salah!'
)
{
this
.
setState
({
errorPassword
:
true
,
msgPassword
:
response
.
data
.
message
})
}
else
{
this
.
setState
({
errorUsername
:
true
,
msgUsername
:
response
.
data
.
message
})
}
}
}
})
})
}
}
...
@@ -59,7 +82,7 @@ class Login extends Component {
...
@@ -59,7 +82,7 @@ class Login extends Component {
<
img
src
=
{
Images
.
imageLogin
}
style
=
{{
marginTop
:
30
}}
/
>
<
img
src
=
{
Images
.
imageLogin
}
style
=
{{
marginTop
:
30
}}
/
>
<
/div
>
<
/div
>
<
div
style
=
{{
width
:
'50%'
,
height
:
'100vh'
,
backgroundColor
:
'#51c6ea'
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
flexDirection
:
'column'
}}
>
<
div
style
=
{{
width
:
'50%'
,
height
:
'100vh'
,
backgroundColor
:
'#51c6ea'
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
flexDirection
:
'column'
}}
>
<
div
style
=
{{
paddingTop
:
56
,
paddingLeft
:
64
,
paddingRight
:
64
,
display
:
'flex'
,
flexDirection
:
'column'
,
width
:
378
,
height
:
43
1
,
borderRadius
:
12
,
boxShadow
:
'0 2 4 0 rgba(0, 0, 0, 0.2)'
,
backgroundColor
:
'#ffffff'
}}
>
<
div
style
=
{{
paddingTop
:
56
,
paddingLeft
:
54
,
paddingRight
:
54
,
display
:
'flex'
,
flexDirection
:
'column'
,
width
:
388
,
height
:
44
1
,
borderRadius
:
12
,
boxShadow
:
'0 2 4 0 rgba(0, 0, 0, 0.2)'
,
backgroundColor
:
'#ffffff'
}}
>
<
img
src
=
{
Images
.
tia
}
/
>
<
img
src
=
{
Images
.
tia
}
/
>
<
TextField
<
TextField
...
@@ -68,11 +91,13 @@ class Login extends Component {
...
@@ -68,11 +91,13 @@ class Login extends Component {
type
=
{
"text"
}
type
=
{
"text"
}
name
=
{
"username"
}
name
=
{
"username"
}
value
=
{
this
.
state
.
username
}
value
=
{
this
.
state
.
username
}
onChange
=
{(
username
)
=>
this
.
handleChange
(
username
)}
onChange
=
{(
username
)
=>
{
this
.
handleChange
(
username
)
}}
variant
=
"outlined"
variant
=
"outlined"
error
=
{
fals
e
}
error
=
{
this
.
state
.
errorUsernam
e
}
style
=
{{
width
:
250
,
height
:
51
,
marginTop
:
32
,
fontSize
:
14
}}
style
=
{{
width
:
'100%'
,
height
:
51
,
marginTop
:
32
,
fontSize
:
14
}}
helperText
=
""
helperText
=
{
this
.
state
.
msgUsername
}
InputProps
=
{{
InputProps
=
{{
endAdornment
:
<
InputAdornment
position
=
"end"
><
img
src
=
{
Images
.
email
}
/></
InputAdornment
>
,
endAdornment
:
<
InputAdornment
position
=
"end"
><
img
src
=
{
Images
.
email
}
/></
InputAdornment
>
,
}}
}}
...
@@ -84,11 +109,13 @@ class Login extends Component {
...
@@ -84,11 +109,13 @@ class Login extends Component {
type
=
{
this
.
state
.
showPass
?
'text'
:
'password'
}
type
=
{
this
.
state
.
showPass
?
'text'
:
'password'
}
name
=
{
"password"
}
name
=
{
"password"
}
value
=
{
this
.
state
.
password
}
value
=
{
this
.
state
.
password
}
onChange
=
{(
password
)
=>
this
.
handleChange
(
password
)
}
onChange
=
{(
password
)
=>
{
this
.
handleChange
(
password
)
}}
variant
=
"outlined"
variant
=
"outlined"
error
=
{
false
}
error
=
{
this
.
state
.
errorPassword
}
style
=
{{
width
:
250
,
height
:
51
,
marginTop
:
20
}}
style
=
{{
width
:
'100%'
,
height
:
51
,
marginTop
:
this
.
state
.
errorUsername
?
35
:
20
}}
helperText
=
""
helperText
=
{
this
.
state
.
msgPassword
}
InputProps
=
{{
InputProps
=
{{
endAdornment
:
<
InputAdornment
position
=
"end"
>
endAdornment
:
<
InputAdornment
position
=
"end"
>
<
IconButton
<
IconButton
...
@@ -103,12 +130,12 @@ class Login extends Component {
...
@@ -103,12 +130,12 @@ class Login extends Component {
}}
}}
/
>
/
>
<
div
style
=
{{
flexDirection
:
'row'
,
width
:
'100%'
,
marginTop
:
16
}}
>
<
div
style
=
{{
flexDirection
:
'row'
,
width
:
'100%'
,
marginTop
:
this
.
state
.
errorPassword
?
26
:
16
}}
>
<
CustomCheckbox
name
=
"checked-remember"
/>
<
CustomCheckbox
name
=
"checked-remember"
/>
<
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
>
<
span
style
=
{{
marginLeft
:
30
,
color
:
'#51c6ea'
,
cursor
:
'pointer'
,
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Lupa
Kata
Sandi
?
<
/span
>
<
span
style
=
{{
marginLeft
:
30
,
color
:
'#51c6ea'
,
cursor
:
'pointer'
,
fontSize
:
12
,
fontFamily
:
'Nunito Sans, sans-serif'
}}
>
Lupa
Kata
Sandi
?
<
/span
>
<
/div
>
<
/div
>
<
Button
name
=
"submit"
variant
=
"contained"
onClick
=
{()
=>
this
.
login
()}
style
=
{{
marginTop
:
23
,
width
:
'100%'
,
height
:
35
,
borderRadius
:
4
}}
>
<
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'
}}
>
<
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
>
...
@@ -118,4 +145,4 @@ class Login extends Component {
...
@@ -118,4 +145,4 @@ class Login extends Component {
}
}
}
}
export
default
Login
;
export
default
Login
;
\ No newline at end of file
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