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
ea7963e0
Commit
ea7963e0
authored
Dec 02, 2020
by
Robin Borgogno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adminPrivate
parent
1ccb4a74
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
39 deletions
+64
-39
game.js
frontend/src/model/game.js
+4
-0
user.js
frontend/src/model/user.js
+0
-26
AdminPrivate.vue
frontend/src/views/AdminPrivate.vue
+56
-7
Inscription.vue
frontend/src/views/Inscription.vue
+0
-2
Login.vue
frontend/src/views/Login.vue
+4
-4
No files found.
frontend/src/model/game.js
0 → 100644
View file @
ea7963e0
let
game
=
{
id
:
0
}
module
.
exports
=
game
\ No newline at end of file
frontend/src/model/user.js
View file @
ea7963e0
// export default class user {
// token = "";
// id = 0;
// putId(id)
// {
// this.id = id
// }
// getId()
// {
// return this.id
// }
// putToken(token)
// {
// this.token = token
// }
// getToken()
// {
// return this.token
// }
// }
let
user
=
{
let
user
=
{
token
:
""
,
token
:
""
,
id
:
0
id
:
0
...
...
frontend/src/views/AdminPrivate.vue
View file @
ea7963e0
...
@@ -4,11 +4,11 @@
...
@@ -4,11 +4,11 @@
<div
class=
"row _centered"
>
<div
class=
"row _centered"
>
<div
class=
"column _600"
>
<div
class=
"column _600"
>
<div
class=
"codeGame"
>
<div
class=
"codeGame"
>
<h1
class=
"titre"
>
Code de la partie :
{{
returnID
()
}}
</h1>
<h1
class=
"titre"
>
Code de la partie :
</h1>
<h1
class=
"titre"
id=
"codeGame"
>
{{
idGame
()
}}{{
return
ID
()
}}
</h1>
<h1
class=
"titre"
id=
"codeGame"
>
{{
game
ID
()
}}
</h1>
</div>
</div>
<div
class=
"joueurs"
>
<div
class=
"joueurs"
>
<!-- ajoute les joueurs présent -->
{{
JoueurPresent
()
}}
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -29,10 +29,11 @@
...
@@ -29,10 +29,11 @@
<
script
>
<
script
>
const
user
=
require
(
"../model/user.js"
)
const
user
=
require
(
"../model/user.js"
)
const
game
=
require
(
"../model/game.js"
)
export
default
{
export
default
{
name
:
'AdminPrivate'
,
name
:
'AdminPrivate'
,
methods
:
{
methods
:
{
i
dGame
:
function
(){
createI
dGame
:
function
(){
const
url
=
"http://localhost/felten/projet-cdaw/backend/MVC/api.php/game"
const
url
=
"http://localhost/felten/projet-cdaw/backend/MVC/api.php/game"
let
data
=
{
let
data
=
{
...
@@ -43,17 +44,65 @@ export default {
...
@@ -43,17 +44,65 @@ export default {
method
:
'POST'
,
method
:
'POST'
,
body
:
JSON
.
stringify
(
data
)
};
body
:
JSON
.
stringify
(
data
)
};
console
.
log
(
user
)
//
console.log(user)
fetch
(
url
,
params
)
fetch
(
url
,
params
)
.
then
(
response
=>
response
.
json
())
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
{
.
then
(
data
=>
{
document
.
getElementById
(
"codeGame"
).
innerHTML
=
data
[
0
].
id
document
.
getElementById
(
"codeGame"
).
innerHTML
=
data
[
0
].
id
;
game
.
id
=
data
[
0
].
id
;
console
.
log
(
game
.
id
)
})
})
},
},
returnID
:
function
(){
gameID
:
function
(){
this
.
createIdGame
()
this
.
ajoutAdminGame
()
},
returnUserID
:
function
(){
return
user
.
id
return
user
.
id
},
returnGameID
:
function
(){
return
game
.
id
},
ajoutAdminGame
:
function
(){
const
url
=
"http://localhost/felten/projet-cdaw/backend/MVC/api.php/gameuser"
console
.
log
(
this
.
returnUserID
())
console
.
log
(
this
.
returnGameID
())
let
data
=
{
"GAME_ID"
:
this
.
returnGameID
(),
"USER_ID"
:
this
.
returnUserID
()
}
var
params
=
{
method
:
'POST'
,
body
:
JSON
.
stringify
(
data
)
};
fetch
(
url
,
params
)
.
then
(
response
=>
response
.
json
())
},
JoueurPresent
:
function
(){
let
url
=
"http://localhost/felten/projet-cdaw/backend/MVC/api.php/gameuser/game"
url
+=
"/"
+
game
.
id
;
var
params
=
{
method
:
"GET"
}
fetch
(
url
,
params
)
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
{
console
.
log
(
data
)
let
text
;
data
.
forEach
(
user
=>
{
text
+=
"<h2 class='joueur' id='joueur'>"
+
user
.
USER_ID
+
"</h2>"
});
document
.
getElementById
(
"joueurs"
).
innerHTML
=
text
})
}
}
},
},
components
:
{
LoginNavbar
},
}
}
import
LoginNavbar
from
'../components/LoginNavbar.vue'
</
script
>
</
script
>
\ No newline at end of file
frontend/src/views/Inscription.vue
View file @
ea7963e0
...
@@ -137,8 +137,6 @@ export default {
...
@@ -137,8 +137,6 @@ export default {
fetch
(
url
,
params
)
fetch
(
url
,
params
)
.
then
(
response
=>
response
.
json
())
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
console
.
log
(
data
))
.
then
(
data
=>
console
.
log
(
data
))
}
}
},
},
...
...
frontend/src/views/Login.vue
View file @
ea7963e0
...
@@ -87,10 +87,10 @@ export default {
...
@@ -87,10 +87,10 @@ export default {
check
:
function
(){
check
:
function
(){
let
login
=
this
.
login
let
login
=
this
.
login
let
password
=
this
.
password
let
password
=
this
.
password
//
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
){
...
...
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