Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projet-cdaw
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
Quentin Vrel
projet-cdaw
Commits
adaaba7e
Commit
adaaba7e
authored
Dec 02, 2020
by
Zohten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
login working
parent
df30501c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
5 deletions
+37
-5
userRequests.http
BackEnd/src/testRequests/userRequests.http
+2
-2
Login.vue
frontend/src/views/Login.vue
+35
-3
No files found.
BackEnd/src/testRequests/userRequests.http
View file @
adaaba7e
...
@@ -8,8 +8,8 @@ GET http://localhost/index.php/user/3
...
@@ -8,8 +8,8 @@ GET http://localhost/index.php/user/3
POST http://localhost/index.php/login
POST http://localhost/index.php/login
{
{
"login": "
dupontd95
",
"login": "
testtest
",
"pwd": "
hasheddupontpwd
"
"pwd": "
$2a$10$4AAhcsd4FpiPvUS718BemuGivzgRcsgxWbaSNdD.dK4wNwJAn.lQO
"
}
}
### Tenter de récupérer un token utilisateur bloqué
### Tenter de récupérer un token utilisateur bloqué
...
...
frontend/src/views/Login.vue
View file @
adaaba7e
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<page-title
pagetitle=
"Se Connecter"
/>
<page-title
pagetitle=
"Se Connecter"
/>
<form
action=
"#"
@
submit
.
prevent=
"onSubmit"
>
<form
action=
"#"
@
submit
.
prevent=
"onSubmit"
>
<div
class=
"form-content"
>
<div
class=
"form-content"
>
<text-input
id=
"
mail"
label=
"Email
"
/>
<text-input
id=
"
login"
label=
"Pseudo
"
/>
<pwd-input
id=
"password"
label=
"Mot de passe"
/>
<pwd-input
id=
"password"
label=
"Mot de passe"
/>
<checkbox-input
id=
"remember"
label=
"Se souvenir de moi"
/>
<checkbox-input
id=
"remember"
label=
"Se souvenir de moi"
/>
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
bcrypt
from
'bcryptjs'
import
PageTitle
from
'@/components/PageTitle.vue'
import
PageTitle
from
'@/components/PageTitle.vue'
import
SvgButton
from
'@/components/SvgButton.vue'
import
SvgButton
from
'@/components/SvgButton.vue'
import
TextInput
from
'@/components/form/TextInput.vue'
import
TextInput
from
'@/components/form/TextInput.vue'
...
@@ -30,16 +31,47 @@ export default {
...
@@ -30,16 +31,47 @@ export default {
PwdInput
,
PwdInput
,
CheckboxInput
CheckboxInput
},
},
data
()
{
return
{
showNotFilledError
:
false
,
}
},
methods
:
{
methods
:
{
onSubmit
:
function
(
event
){
onSubmit
:
async
function
(
event
){
if
(
event
.
submitter
.
id
==
'back'
)
{
if
(
event
.
submitter
.
id
==
'back'
)
{
this
.
$router
.
push
(
'/'
);
this
.
$router
.
push
(
'/'
);
}
}
// Test if all fields are filled
this
.
showNotFilledError
=
(
document
.
getElementById
(
'login'
).
value
==
''
||
document
.
getElementById
(
'password'
).
value
==
''
);
if
(
this
.
showNotFilledError
)
{
return
;
}
// Get auth token if everything is okay
if
(
event
.
submitter
.
id
==
'validate'
)
{
if
(
event
.
submitter
.
id
==
'validate'
)
{
let
request
=
await
fetch
(
this
.
$apiRoot
+
'/login'
,
{
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/json;charset=utf-8'
},
body
:
JSON
.
stringify
({
login
:
document
.
getElementById
(
'login'
).
value
,
pwd
:
bcrypt
.
hashSync
(
document
.
getElementById
(
'password'
).
value
,
"$2a$10$4AAhcsd4FpiPvUS718Bemu"
),
})
});
//creating the content and sending the request
let
response
=
await
request
;
if
(
response
.
ok
){
this
.
$router
.
push
(
'lobby'
);
this
.
$router
.
push
(
'lobby'
);
}
}
}
}
}
}
}
}
}
</
script
>
</
script
>
...
...
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