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
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
Thibaut Felten
projet-cdaw
Commits
585bc870
Commit
585bc870
authored
Dec 02, 2020
by
Robin Borgogno
Browse files
Options
Browse Files
Download
Plain Diff
adminPrivate
parents
ea7963e0
97c6d41d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
23 deletions
+75
-23
LoginNavbar.vue
frontend/src/components/LoginNavbar.vue
+10
-5
Accueil.vue
frontend/src/views/Accueil.vue
+6
-0
AdminPrivate.vue
frontend/src/views/AdminPrivate.vue
+9
-0
Inscription.vue
frontend/src/views/Inscription.vue
+29
-5
Login.vue
frontend/src/views/Login.vue
+21
-13
No files found.
frontend/src/components/LoginNavbar.vue
View file @
585bc870
...
...
@@ -3,11 +3,11 @@
<button
class=
"btn-login"
>
<router-link
to=
"/"
>
Accueil
</router-link>
</button>
<button
class=
"btn-login"
v-if=
"
connected
"
>
<router-link
to=
"/inscription"
>
Sign Up
</router-link>
<button
class=
"btn-login"
v-if=
"
user.id==0
"
>
<router-link
to=
"/inscription"
>
Inscription
</router-link>
</button>
<button
class=
"btn-login"
v-if=
"
connected
"
>
<router-link
to=
"/login"
>
Log I
n
</router-link>
<button
class=
"btn-login"
v-if=
"
user.id==0
"
>
<router-link
to=
"/login"
>
Connectio
n
</router-link>
</button>
</nav>
...
...
@@ -15,16 +15,21 @@
<
script
>
const
user
=
require
(
"../model/user.js"
)
export
default
{
name
:
'LoginNavbar'
,
data
(){
// the data, declared as function
return
{
// we return all the properties that should be react on.
connected
:
true
user
}
},
}
console
.
log
(
user
.
id
);
</
script
>
<
style
scoped
>
...
...
frontend/src/views/Accueil.vue
View file @
585bc870
...
...
@@ -45,7 +45,13 @@ export default {
components
:
{
LoginNavbar
},
data
(){
// the data, declared as function
return
{
// we return all the properties that should be react on.
user
}
},
}
const
user
=
require
((
"../model/user.js"
))
import
LoginNavbar
from
'../components/LoginNavbar.vue'
</
script
>
\ No newline at end of file
frontend/src/views/AdminPrivate.vue
View file @
585bc870
...
...
@@ -99,10 +99,19 @@ export default {
})
}
<<<<<<<
HEAD
},
components
:
{
LoginNavbar
},
}
=======
},
components
:{
LoginNavbar
}
}
>>>>>>>
97
c6d41dc424575a3414673ca6d5e508e1423274
import
LoginNavbar
from
'../components/LoginNavbar.vue'
</
script
>
\ No newline at end of file
frontend/src/views/Inscription.vue
View file @
585bc870
...
...
@@ -90,12 +90,24 @@
</
style
>
<
script
>
const
user
=
require
(
"../model/user.js"
)
export
default
{
name
:
'Inscription'
,
components
:
{
LoginNavbar
},
methods
:
{
name
:
'Inscription'
,
components
:
{
LoginNavbar
},
data
(){
// the data, declared as function
return
{
// we return all the properties that should be react on.
firstname
:
""
,
lastname
:
""
,
login
:
""
,
email
:
""
,
password
:
""
,
confirmpassword
:
""
}
},
methods
:
{
check
:
function
(){
let
firstname
=
this
.
firstname
let
lastname
=
this
.
lastname
...
...
@@ -136,11 +148,23 @@ export default {
fetch
(
url
,
params
)
.
then
(
response
=>
response
.
json
())
<<<<<<<
HEAD
.
then
(
data
=>
console
.
log
(
data
))
=======
.
then
(
response
=>
{
user
.
token
=
response
.
jwt_token
user
.
id
=
response
.
id
})
.
then
(
this
.
$router
.
push
(
'/'
))
>>>>>>>
97
c6d41dc424575a3414673ca6d5e508e1423274
}
},
}
import
LoginNavbar
from
'../components/LoginNavbar.vue'
</
script
>
frontend/src/views/Login.vue
View file @
585bc870
...
...
@@ -7,11 +7,11 @@
<form
id=
"loginForm"
class=
"form"
v-on:submit
.
prevent=
"check"
>
<div
class=
"row lpad"
>
<label
for=
"Login"
>
Login
</label>
<input
v-model=
"log
in
"
type=
"text"
name=
"Login"
id=
"loginValue"
required
>
<input
v-model=
"log"
type=
"text"
name=
"Login"
id=
"loginValue"
required
>
</div>
<div
class=
"row lpad"
>
<label
for=
"Password"
>
Mot de passe
</label>
<input
v-model=
"pass
word
"
type=
"password"
name=
"Password"
id=
"passwordValue"
required
>
<input
v-model=
"pass"
type=
"password"
name=
"Password"
id=
"passwordValue"
required
>
</div>
<div
class=
"row lpad"
>
<button
type=
"submit"
class=
"btn"
>
Valider
</button>
...
...
@@ -78,15 +78,22 @@ const user = require("../model/user.js")
export
default
{
name
:
'Login'
,
data
(
connect
){
// the data, declared as function
return
{
// we return all the properties that should be react on.
connected
:
connect
}
data
(){
// the data, declared as function
return
{
// we return all the properties that should be react on.
log
:
''
,
pass
:
''
}
},
methods
:
{
check
:
function
(){
<<<<<<<
HEAD
let
login
=
this
.
login
let
password
=
this
.
password
=======
let
login
=
this
.
log
let
password
=
this
.
pass
>>>>>>>
97
c6d41dc424575a3414673ca6d5e508e1423274
var
bcrypt
=
require
(
'bcryptjs'
);
var
salt
=
"$2a$08$c0GzKSB8g6.rZLF98GJvQu"
var
hash
=
bcrypt
.
hashSync
(
password
,
salt
)
...
...
@@ -94,14 +101,16 @@ export default {
},
call
:
function
(
login
,
password
){
const
url
=
"http://localhost/felten/projet-cdaw/backend/MVC/api.php/login"
const
url
=
"http://localhost/projet-cdaw/backend/MVC/api.php/login"
// Robin config
// const url = "http://localhost/felten/projet-cdaw/backend/MVC/api.php/login"
let
data
=
{
login
:
login
,
pwd
:
password
}
var
params
=
{
method
:
'POST'
,
body
:
JSON
.
stringify
(
data
)
...
...
@@ -110,11 +119,10 @@ export default {
fetch
(
url
,
params
)
.
then
(
response
=>
response
.
json
())
.
then
(
response
=>
{
sessionStorage
.
setItem
(
"JWT_TOKEN"
,
response
.
data
.
jwt_token
)
user
.
token
=
response
.
jwt_token
user
.
id
=
response
.
data
.
id
console
.
log
(
response
)
user
.
token
=
response
.
jwt_token
user
.
id
=
response
.
data
.
id
})
.
then
(
this
.
$router
.
push
(
"/"
))
}
},
components
:
{
...
...
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