Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EDB-Apo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Adrian Christian Beilharz
EDB-Apo
Commits
8e662d51
Commit
8e662d51
authored
4 years ago
by
AdrianBeilharz
Browse files
Options
Downloads
Patches
Plain Diff
change password field, error message on wrong credentials
parent
bbce5c30
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
frontend/src/components/startseite/Login.js
+57
-56
57 additions, 56 deletions
frontend/src/components/startseite/Login.js
with
57 additions
and
56 deletions
frontend/src/components/startseite/Login.js
+
57
−
56
View file @
8e662d51
import
React
,
{
useState
}
from
'
react
'
;
import
React
,
{
useState
}
from
'
react
'
;
import
{
Row
,
Col
,
Button
,
Form
,}
from
'
react-bootstrap
'
;
import
{
Col
,
Button
,
Form
,}
from
'
react-bootstrap
'
;
import
{
useForm
}
from
"
react-hook-form
"
;
import
ApothekeRegisterModal
from
'
../../modals/ApothekeRegisterModal
'
;
import
ApothekeRegisterModal
from
'
../../modals/ApothekeRegisterModal
'
;
import
{
useSnackbar
}
from
'
notistack
'
;
import
'
./Startseite.scss
'
import
'
./Startseite.scss
'
function
Login
(
props
)
{
function
Login
(
props
)
{
const
[
neuesApoRegisterModal
,
setNeuesApoRegisterModal
]
=
useState
(
false
);
const
[
neuesApoRegisterModal
,
setNeuesApoRegisterModal
]
=
useState
(
false
);
const
{
handleSubmit
}
=
useForm
();
const
{
enqueueSnackbar
}
=
useSnackbar
();
const
[
user
,
setUser
]
=
useState
({
username
:
''
,
password
:
''
});
const
login
=
async
event
=>
{
const
login
=
async
event
=>
{
event
.
preventDefault
();
const
response
=
await
fetch
(
`http://
${
process
.
env
.
REACT_APP_BACKEND_URL
}
/login`
,
{
let
{
username
,
password
}
=
event
.
target
;
method
:
'
POST
'
,
let
body
=
{
username
:
username
.
value
,
password
:
password
.
value
};
headers
:
{
const
response
=
await
fetch
(
`http://
${
process
.
env
.
REACT_APP_BACKEND_URL
}
/login`
,
{
'
Content-Type
'
:
'
application/json
'
method
:
'
POST
'
,
},
headers
:
{
body
:
JSON
.
stringify
({
'
Content-Type
'
:
'
application/json
'
username
:
user
.
username
,
},
password
:
user
.
password
body
:
JSON
.
stringify
(
body
)
})
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
//SHOW ERROR
//SHOW ERROR
console
.
log
(
err
);
console
.
log
(
err
);
});
});
if
(
response
&&
response
.
status
===
200
){
if
(
response
&&
response
.
status
===
200
){
const
data
=
await
response
.
json
();
const
data
=
await
response
.
json
();
window
.
sessionStorage
.
setItem
(
"
edbapo-jwt
"
,
data
.
jwt
)
window
.
sessionStorage
.
setItem
(
"
edbapo-jwt
"
,
data
.
jwt
)
props
.
history
.
push
(
`/apotheke/
${
data
.
apothekeId
}
`
);
props
.
history
.
push
(
`/apotheke/
${
data
.
apothekeId
}
`
);
}
else
{
}
enqueueSnackbar
(
"
Nutzername oder Passwort ist Falsch
"
,
{
variant
:
"
error
"
,
autoHideDuration
:
3000
,
anchorOrigin
:
{
vertical
:
'
bottom
'
,
horizontal
:
'
left
'
}});
}
}
}
return
(
<
div
className
=
"
login
"
>
return
(
<
b
style
=
{{
fontSize
:
'
20pt
'
}}
>
Login
:
<
/b
>
<
div
className
=
"
login
"
>
<
Form
onSubmit
=
{
handleSubmit
(
login
)}
>
<
b
style
=
{{
fontSize
:
'
20pt
'
}}
>
Login
:
<
/b>
<
Form
.
Row
>
<
Form
onSubmit
=
{
login
}
>
<
Col
>
<
Form
.
Row
>
<
Form
.
Control
onChange
=
{
e
=>
setUser
({...
user
,
username
:
e
.
target
.
value
})}
placeholder
=
"
Benutzername
"
/>
<
Col
>
<
Form
.
Control
onChange
=
{
e
=>
setUser
({...
user
,
password
:
e
.
target
.
value
})}
placeholder
=
"
Passwort
"
/>
<
Form
.
Control
name
=
"
username
"
placeholder
=
"
Benutzername
"
required
/>
<
Button
variant
=
"
primary
"
type
=
"
submit
"
>
Login
<
/Button>
<
Form
.
Control
name
=
"
password
"
placeholder
=
"
Passwort
"
type
=
"
password
"
required
/>
<
Button
variant
=
"
primary
"
show
=
{
neuesApoRegisterModal
}
onClick
=
{()
=>
setNeuesApoRegisterModal
(
true
)}
>
Neue
Apotheke
registrieren
<
/Button
>
<
Button
variant
=
"
primary
"
type
=
"
submit
"
>
Login
<
/Button>
<
ApothekeRegisterModal
<
Button
variant
=
"
primary
"
show
=
{
neuesApoRegisterModal
}
onClick
=
{()
=>
setNeuesApoRegisterModal
(
true
)}
>
Neue
Apotheke
registrieren
<
/Button>
show
=
{
neuesApoRegisterModal
}
<
ApothekeRegisterModal
{...
props
}
show
=
{
neuesApoRegisterModal
}
onHide
=
{()
=>
setNeuesApoRegisterModal
(
false
)}
><
/ApothekeRegisterModal
>
{...
props
}
<
/Col
>
onHide
=
{()
=>
setNeuesApoRegisterModal
(
false
)}
><
/ApothekeRegisterModal>
<
/Form.Row
>
<
/Col>
<
/Form
>
<
/Form.Row>
<
/div
>
<
/Form>
)
<
/div>
}
)
export
default
Login
;
}
\ No newline at end of file
export
default
Login
;
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