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
0a5da1e0
Commit
0a5da1e0
authored
Dec 02, 2020
by
thibaut-felten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Errors
parent
1ccb4a74
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
25 deletions
+56
-25
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
+6
-1
Inscription.vue
frontend/src/views/Inscription.vue
+10
-0
Login.vue
frontend/src/views/Login.vue
+24
-19
No files found.
frontend/src/components/LoginNavbar.vue
View file @
0a5da1e0
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
<button
class=
"btn-login"
>
<button
class=
"btn-login"
>
<router-link
to=
"/"
>
Accueil
</router-link>
<router-link
to=
"/"
>
Accueil
</router-link>
</button>
</button>
<button
class=
"btn-login"
v-if=
"
connected
"
>
<button
class=
"btn-login"
v-if=
"
user.id==0
"
>
<router-link
to=
"/inscription"
>
Sign Up
</router-link>
<router-link
to=
"/inscription"
>
Inscription
</router-link>
</button>
</button>
<button
class=
"btn-login"
v-if=
"
connected
"
>
<button
class=
"btn-login"
v-if=
"
user.id==0
"
>
<router-link
to=
"/login"
>
Log I
n
</router-link>
<router-link
to=
"/login"
>
Connectio
n
</router-link>
</button>
</button>
</nav>
</nav>
...
@@ -15,16 +15,21 @@
...
@@ -15,16 +15,21 @@
<
script
>
<
script
>
const
user
=
require
(
"../model/user.js"
)
export
default
{
export
default
{
name
:
'LoginNavbar'
,
name
:
'LoginNavbar'
,
data
(){
// the data, declared as function
data
(){
// the data, declared as function
return
{
// we return all the properties that should be react on.
return
{
// we return all the properties that should be react on.
connected
:
true
user
}
}
},
},
}
}
console
.
log
(
user
.
id
);
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
...
...
frontend/src/views/Accueil.vue
View file @
0a5da1e0
...
@@ -45,7 +45,13 @@ export default {
...
@@ -45,7 +45,13 @@ export default {
components
:
{
components
:
{
LoginNavbar
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'
import
LoginNavbar
from
'../components/LoginNavbar.vue'
</
script
>
</
script
>
\ No newline at end of file
frontend/src/views/AdminPrivate.vue
View file @
0a5da1e0
...
@@ -54,6 +54,11 @@ export default {
...
@@ -54,6 +54,11 @@ export default {
returnID
:
function
(){
returnID
:
function
(){
return
user
.
id
return
user
.
id
}
}
},
},
components
:{
LoginNavbar
}
}
}
import
LoginNavbar
from
'../components/LoginNavbar.vue'
</
script
>
</
script
>
\ No newline at end of file
frontend/src/views/Inscription.vue
View file @
0a5da1e0
...
@@ -94,6 +94,16 @@ export default {
...
@@ -94,6 +94,16 @@ export default {
name
:
'Inscription'
,
name
:
'Inscription'
,
components
:
{
components
:
{
LoginNavbar
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
:
{
methods
:
{
check
:
function
(){
check
:
function
(){
...
...
frontend/src/views/Login.vue
View file @
0a5da1e0
...
@@ -7,11 +7,11 @@
...
@@ -7,11 +7,11 @@
<form
id=
"loginForm"
class=
"form"
v-on:submit
.
prevent=
"check"
>
<form
id=
"loginForm"
class=
"form"
v-on:submit
.
prevent=
"check"
>
<div
class=
"row lpad"
>
<div
class=
"row lpad"
>
<label
for=
"Login"
>
Login
</label>
<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>
<div
class=
"row lpad"
>
<div
class=
"row lpad"
>
<label
for=
"Password"
>
Mot de passe
</label>
<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>
<div
class=
"row lpad"
>
<div
class=
"row lpad"
>
<button
type=
"submit"
class=
"btn"
>
Valider
</button>
<button
type=
"submit"
class=
"btn"
>
Valider
</button>
...
@@ -78,30 +78,34 @@ const user = require("../model/user.js")
...
@@ -78,30 +78,34 @@ const user = require("../model/user.js")
export
default
{
export
default
{
name
:
'Login'
,
name
:
'Login'
,
data
(
connect
){
// the data, declared as function
data
(){
// the data, declared as function
return
{
// we return all the properties that should be react on.
return
{
// we return all the properties that should be react on.
connected
:
connect
log
:
''
,
}
pass
:
''
}
},
},
methods
:
{
methods
:
{
check
:
function
(){
check
:
function
(){
let
login
=
this
.
log
in
let
login
=
this
.
log
let
password
=
this
.
pass
word
let
password
=
this
.
pass
//
var bcrypt = require('bcryptjs');
var
bcrypt
=
require
(
'bcryptjs'
);
//
var salt = "$2a$08$c0GzKSB8g6.rZLF98GJvQu"
var
salt
=
"$2a$08$c0GzKSB8g6.rZLF98GJvQu"
//
var hash = bcrypt.hashSync(password, salt)
var
hash
=
bcrypt
.
hashSync
(
password
,
salt
)
this
.
call
(
login
,
password
)
this
.
call
(
login
,
hash
)
},
},
call
:
function
(
login
,
password
){
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
=
{
let
data
=
{
login
:
login
,
login
:
login
,
pwd
:
password
pwd
:
password
}
}
var
params
=
{
var
params
=
{
method
:
'POST'
,
method
:
'POST'
,
body
:
JSON
.
stringify
(
data
)
body
:
JSON
.
stringify
(
data
)
...
@@ -110,11 +114,12 @@ export default {
...
@@ -110,11 +114,12 @@ export default {
fetch
(
url
,
params
)
fetch
(
url
,
params
)
.
then
(
response
=>
response
.
json
())
.
then
(
response
=>
response
.
json
())
.
then
(
response
=>
{
.
then
(
response
=>
{
sessionStorage
.
setItem
(
"JWT_TOKEN"
,
response
.
data
.
jwt_token
)
console
.
log
(
response
)
user
.
token
=
response
.
jwt_token
user
.
token
=
response
.
jwt_token
user
.
id
=
response
.
data
.
id
user
.
id
=
response
.
data
.
id
console
.
log
(
response
)
console
.
log
(
user
)
})
})
.
then
(
this
.
$router
.
push
(
"/"
))
}
}
},
},
components
:
{
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