Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
exam_12_Tsoy_Danil
Project
Project
Details
Activity
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
Цой Данил
exam_12_Tsoy_Danil
Commits
eb0ff9cc
Commit
eb0ff9cc
authored
Apr 15, 2023
by
Цой Данил
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rebuild authorize page. Now it has password that could be shown or hidden
parent
e2fd31d3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
373 additions
and
25 deletions
+373
-25
package-lock.json
frontend/package-lock.json
+295
-0
package.json
frontend/package.json
+2
-0
AuthorizeForm.module.css
...end/src/containers/AuthorizeForm/AuthorizeForm.module.css
+4
-2
AuthorizeForm.tsx
frontend/src/containers/AuthorizeForm/AuthorizeForm.tsx
+72
-23
No files found.
frontend/package-lock.json
View file @
eb0ff9cc
This diff is collapsed.
Click to expand it.
frontend/package.json
View file @
eb0ff9cc
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
"dependencies"
:
{
"dependencies"
:
{
"@emotion/react"
:
"^11.10.6"
,
"@emotion/react"
:
"^11.10.6"
,
"@emotion/styled"
:
"^11.10.6"
,
"@emotion/styled"
:
"^11.10.6"
,
"@material/icon-button"
:
"^14.0.0"
,
"@mui/icons-material"
:
"^5.11.16"
,
"@mui/material"
:
"^5.12.0"
,
"@mui/material"
:
"^5.12.0"
,
"@reduxjs/toolkit"
:
"^1.9.3"
,
"@reduxjs/toolkit"
:
"^1.9.3"
,
"@types/axios"
:
"^0.14.0"
,
"@types/axios"
:
"^0.14.0"
,
...
...
frontend/src/containers/AuthorizeForm/AuthorizeForm.module.css
View file @
eb0ff9cc
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
justify-content
:
center
;
justify-content
:
center
;
align-items
:
center
;
align-items
:
center
;
margin-top
:
100px
;
margin-top
:
100px
;
color
:
black
;
}
}
.AuthorizeForm
p
{
.AuthorizeForm
p
{
...
@@ -18,12 +19,13 @@
...
@@ -18,12 +19,13 @@
flex-direction
:
column
;
flex-direction
:
column
;
align-items
:
center
;
align-items
:
center
;
padding
:
20px
;
padding
:
20px
;
background
:
rgb
a
(
83
,
26
,
136
,
0.659
);
background
:
rgb
(
255
,
255
,
255
);
border-radius
:
5px
;
border-radius
:
5px
;
}
}
.login_input
{
.login_input
{
width
:
80%
;
width
:
80%
;
color
:
white
;
height
:
40px
;
height
:
40px
;
padding
:
5px
;
padding
:
5px
;
border-radius
:
7px
;
border-radius
:
7px
;
...
@@ -88,7 +90,7 @@
...
@@ -88,7 +90,7 @@
}
}
.login_btn
{
.login_btn
{
margin
:
0
auto
;
margin
:
0
auto
;
margin-top
:
3
0px
;
margin-top
:
1
0px
;
width
:
170px
;
width
:
170px
;
height
:
50px
;
height
:
50px
;
}
}
...
...
frontend/src/containers/AuthorizeForm/AuthorizeForm.tsx
View file @
eb0ff9cc
...
@@ -7,6 +7,9 @@ import { shallowEqual, useSelector } from 'react-redux'
...
@@ -7,6 +7,9 @@ import { shallowEqual, useSelector } from 'react-redux'
import
Preloader
from
'../../components/UI/Preloader/Preloader'
import
Preloader
from
'../../components/UI/Preloader/Preloader'
import
{
createUser
,
hideMessage
,
loginUser
}
from
'../../store/user/user.slice'
import
{
createUser
,
hideMessage
,
loginUser
}
from
'../../store/user/user.slice'
import
Alert
from
'@mui/material/Alert'
;
import
Alert
from
'@mui/material/Alert'
;
import
Visibility
from
'@mui/icons-material/Visibility'
;
import
VisibilityOff
from
'@mui/icons-material/VisibilityOff'
;
import
{
FormControl
,
FormControlLabel
,
IconButton
,
InputAdornment
,
InputLabel
,
OutlinedInput
,
Switch
,
TextField
}
from
'@mui/material'
const
AuthorizeForm
:
React
.
FunctionComponent
=
():
React
.
ReactElement
=>
{
const
AuthorizeForm
:
React
.
FunctionComponent
=
():
React
.
ReactElement
=>
{
const
navigate
=
useNavigate
()
const
navigate
=
useNavigate
()
...
@@ -23,6 +26,10 @@ const AuthorizeForm: React.FunctionComponent = (): React.ReactElement => {
...
@@ -23,6 +26,10 @@ const AuthorizeForm: React.FunctionComponent = (): React.ReactElement => {
const
[
isLoginUser
,
setIsLoginUser
]
=
useState
<
boolean
>
(
true
)
const
[
isLoginUser
,
setIsLoginUser
]
=
useState
<
boolean
>
(
true
)
const
[
showPassword
,
setShowPassword
]
=
useState
<
boolean
>
(
false
);
const
handleClickShowPassword
=
()
=>
setShowPassword
((
show
)
=>
!
show
);
const
inputHandler
=
(
e
:
React
.
ChangeEvent
<
HTMLInputElement
>
):
void
=>
{
const
inputHandler
=
(
e
:
React
.
ChangeEvent
<
HTMLInputElement
>
):
void
=>
{
setUserValues
(
prevState
=>
{
setUserValues
(
prevState
=>
{
return
{...
prevState
,
[
e
.
target
.
name
]:
e
.
target
.
value
}
return
{...
prevState
,
[
e
.
target
.
name
]:
e
.
target
.
value
}
...
@@ -42,6 +49,10 @@ const AuthorizeForm: React.FunctionComponent = (): React.ReactElement => {
...
@@ -42,6 +49,10 @@ const AuthorizeForm: React.FunctionComponent = (): React.ReactElement => {
}
}
}
}
const
handleMouseDownPassword
=
(
event
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
=>
{
event
.
preventDefault
();
};
useEffect
(()
=>
{
useEffect
(()
=>
{
checkButton
()
checkButton
()
},[
userValues
])
},[
userValues
])
...
@@ -77,35 +88,73 @@ const AuthorizeForm: React.FunctionComponent = (): React.ReactElement => {
...
@@ -77,35 +88,73 @@ const AuthorizeForm: React.FunctionComponent = (): React.ReactElement => {
</
Alert
>
:
null
</
Alert
>
:
null
}
}
<
p
>
{
isLoginUser
?
'Login user'
:
'Authorize user'
}
</
p
>
<
p
>
{
isLoginUser
?
'Login user'
:
'Authorize user'
}
</
p
>
<
p
>
Username:
</
p
>
{
/* <OutlinedInput
<
input
label="Username"
className=
{
styles
.
login_input
}
name={'username'}
placeholder=
'username...'
name=
{
'username'
}
autoComplete='off'
autoComplete='off'
value={userValues.username}
value={userValues.username}
onChange={inputHandler}
onChange={inputHandler}
style={{
marginBottom: '20px'
}}
/> */
}
<
FormControl
sx=
{
{
m
:
1
,
width
:
'80%'
}
}
variant=
"outlined"
>
<
InputLabel
htmlFor=
"outlined-adornment-password"
>
Username
</
InputLabel
>
<
OutlinedInput
id=
"outlined-adornment-password"
type=
{
'text'
}
label=
"Username"
name=
{
'username'
}
autoComplete=
'off'
value=
{
userValues
.
username
}
onChange=
{
inputHandler
}
style=
{
{
marginBottom
:
'10px'
,
width
:
'100%'
}
}
/>
/>
<
p
>
Password:
</
p
>
</
FormControl
>
<
input
className=
{
styles
.
login_input
}
placeholder=
'password...'
<
FormControl
sx=
{
{
m
:
1
,
width
:
'80%'
}
}
variant=
"outlined"
>
name=
{
'password'
}
<
InputLabel
htmlFor=
"outlined-adornment-password"
>
Password
</
InputLabel
>
type=
'password'
<
OutlinedInput
autoComplete=
'off'
id=
"outlined-adornment-password"
value=
{
userValues
.
password
}
type=
{
showPassword
?
'text'
:
'password'
}
onChange=
{
inputHandler
}
label=
"Password"
name=
{
'password'
}
autoComplete=
'off'
value=
{
userValues
.
password
}
onChange=
{
inputHandler
}
style=
{
{
marginBottom
:
'10px'
,
width
:
'100%'
}
}
endAdornment=
{
<
InputAdornment
position=
"end"
>
<
IconButton
aria
-
label=
"toggle password visibility"
onClick=
{
handleClickShowPassword
}
onMouseDown=
{
handleMouseDownPassword
}
edge=
"end"
>
{
showPassword
?
<
VisibilityOff
/>
:
<
Visibility
/>
}
</
IconButton
>
</
InputAdornment
>
}
/>
/>
<
label
style=
{
{
display
:
'flex'
,
alignItems
:
'center'
}
}
>
</
FormControl
>
<
input
<
FormControlLabel
className=
{
styles
.
toggleCheckbox
}
control=
{
<
Switch
type=
"checkbox"
checked=
{
isLoginUser
}
checked=
{
isLoginUser
}
onChange=
{
toggleChangeHandler
}
onChange=
{
toggleChangeHandler
}
/>
inputProps=
{
{
'aria-label'
:
'controlled'
}
}
<
div
className=
{
styles
.
toggleSwitch
}
></
div
>
/>
}
<
span
className=
{
styles
.
toggleLabel
}
>
New user?
</
span
>
label=
{
<
p
style=
{
{
color
:
'black'
}
}
>
Add new user
</
p
>
}
</
label
>
/
>
<
button
<
button
className=
{
styles
.
login_btn
}
className=
{
styles
.
login_btn
}
disabled=
{
buttonDisabled
}
disabled=
{
buttonDisabled
}
...
...
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