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
1ccb4a74
Commit
1ccb4a74
authored
Dec 02, 2020
by
thibaut-felten
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gvipers.imt-lille-douai.fr/thibaut.felten/projet-cdaw
into master
parents
1ede4162
8f9e8061
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
174 additions
and
121 deletions
+174
-121
LoginController.class.php
backend/MVC/controller/LoginController.class.php
+2
-1
Game.sql.php
backend/MVC/sql/Game.sql.php
+1
-1
package-lock.json
frontend/package-lock.json
+79
-81
user.js
frontend/src/model/user.js
+31
-0
index.js
frontend/src/router/index.js
+5
-0
Accueil.vue
frontend/src/views/Accueil.vue
+1
-0
AdminPrivate.vue
frontend/src/views/AdminPrivate.vue
+33
-15
ChoixPartie.vue
frontend/src/views/ChoixPartie.vue
+4
-6
Login.vue
frontend/src/views/Login.vue
+18
-17
No files found.
backend/MVC/controller/LoginController.class.php
View file @
1ccb4a74
...
@@ -47,7 +47,8 @@ class LoginController extends Controller {
...
@@ -47,7 +47,8 @@ class LoginController extends Controller {
$jwt
=
JWT
::
encode
(
$token
,
JWT_BACKEND_KEY
);
$jwt
=
JWT
::
encode
(
$token
,
JWT_BACKEND_KEY
);
$jsonResult
=
json_encode
(
$jsonResult
=
json_encode
(
array
(
array
(
"jwt_token"
=>
$jwt
"jwt_token"
=>
$jwt
,
"data"
=>
$token
[
'data'
]
)
)
);
);
...
...
backend/MVC/sql/Game.sql.php
View file @
1ccb4a74
...
@@ -10,7 +10,7 @@ Game::addSqlQuery('GAME_CREATE',
...
@@ -10,7 +10,7 @@ Game::addSqlQuery('GAME_CREATE',
"INSERT INTO GAME (GAME_ID, GAME_DESC) VALUES (NULL, :GAME_DESC)"
);
"INSERT INTO GAME (GAME_ID, GAME_DESC) VALUES (NULL, :GAME_DESC)"
);
Game
::
addSqlQuery
(
'GAME_ID_MAX'
,
Game
::
addSqlQuery
(
'GAME_ID_MAX'
,
"SELECT MAX(GAME_ID) FROM GAME"
);
"SELECT MAX(GAME_ID)
AS id
FROM GAME"
);
Game
::
addSqlQuery
(
'GAME_UPDATE'
,
Game
::
addSqlQuery
(
'GAME_UPDATE'
,
"UPDATE GAME SET GAME_DESC=:GAME_DESC WHERE GAME_ID=:GAME_ID"
);
"UPDATE GAME SET GAME_DESC=:GAME_DESC WHERE GAME_ID=:GAME_ID"
);
...
...
frontend/package-lock.json
View file @
1ccb4a74
...
@@ -1733,6 +1733,16 @@
...
@@ -1733,6 +1733,16 @@
"integrity"
:
"sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A=="
,
"integrity"
:
"sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A=="
,
"dev"
:
true
"dev"
:
true
},
},
"ansi-styles"
:
{
"version"
:
"4.3.0"
,
"resolved"
:
"https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz"
,
"integrity"
:
"sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-convert"
:
"^2.0.1"
}
},
"cacache"
:
{
"cacache"
:
{
"version"
:
"13.0.1"
,
"version"
:
"13.0.1"
,
"resolved"
:
"https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz"
,
"resolved"
:
"https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz"
,
...
@@ -1759,6 +1769,34 @@
...
@@ -1759,6 +1769,34 @@
"unique-filename"
:
"^1.1.1"
"unique-filename"
:
"^1.1.1"
}
}
},
},
"chalk"
:
{
"version"
:
"4.1.0"
,
"resolved"
:
"https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz"
,
"integrity"
:
"sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"ansi-styles"
:
"^4.1.0"
,
"supports-color"
:
"^7.1.0"
}
},
"color-convert"
:
{
"version"
:
"2.0.1"
,
"resolved"
:
"https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz"
,
"integrity"
:
"sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-name"
:
"~1.1.4"
}
},
"color-name"
:
{
"version"
:
"1.1.4"
,
"resolved"
:
"https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz"
,
"integrity"
:
"sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
,
"dev"
:
true
,
"optional"
:
true
},
"find-cache-dir"
:
{
"find-cache-dir"
:
{
"version"
:
"3.3.1"
,
"version"
:
"3.3.1"
,
"resolved"
:
"https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz"
,
"resolved"
:
"https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz"
,
...
@@ -1780,6 +1818,25 @@
...
@@ -1780,6 +1818,25 @@
"path-exists"
:
"^4.0.0"
"path-exists"
:
"^4.0.0"
}
}
},
},
"has-flag"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz"
,
"integrity"
:
"sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
,
"dev"
:
true
,
"optional"
:
true
},
"loader-utils"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz"
,
"integrity"
:
"sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"big.js"
:
"^5.2.2"
,
"emojis-list"
:
"^3.0.0"
,
"json5"
:
"^2.1.2"
}
},
"locate-path"
:
{
"locate-path"
:
{
"version"
:
"5.0.0"
,
"version"
:
"5.0.0"
,
"resolved"
:
"https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz"
,
"resolved"
:
"https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz"
,
...
@@ -1844,6 +1901,16 @@
...
@@ -1844,6 +1901,16 @@
"minipass"
:
"^3.1.1"
"minipass"
:
"^3.1.1"
}
}
},
},
"supports-color"
:
{
"version"
:
"7.2.0"
,
"resolved"
:
"https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz"
,
"integrity"
:
"sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"has-flag"
:
"^4.0.0"
}
},
"terser-webpack-plugin"
:
{
"terser-webpack-plugin"
:
{
"version"
:
"2.3.8"
,
"version"
:
"2.3.8"
,
"resolved"
:
"https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz"
,
"resolved"
:
"https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz"
,
...
@@ -1860,6 +1927,18 @@
...
@@ -1860,6 +1927,18 @@
"terser"
:
"^4.6.12"
,
"terser"
:
"^4.6.12"
,
"webpack-sources"
:
"^1.4.3"
"webpack-sources"
:
"^1.4.3"
}
}
},
"vue-loader-v16"
:
{
"version"
:
"npm:vue-loader@16.1.0"
,
"resolved"
:
"https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.0.tgz"
,
"integrity"
:
"sha512-fTtCdI7VeyNK0HP4q4y9Z9ts8TUeaF+2/FjKx8CJ/7/Oem1rCX7zIJe+d+jLrVnVNQjENd3gqmANraLcdRWwnQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"chalk"
:
"^4.1.0"
,
"hash-sum"
:
"^2.0.0"
,
"loader-utils"
:
"^2.0.0"
}
}
}
}
}
},
},
...
@@ -10906,87 +10985,6 @@
...
@@ -10906,87 +10985,6 @@
}
}
}
}
},
},
"vue-loader-v16"
:
{
"version"
:
"npm:vue-loader@16.1.0"
,
"resolved"
:
"https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.0.tgz"
,
"integrity"
:
"sha512-fTtCdI7VeyNK0HP4q4y9Z9ts8TUeaF+2/FjKx8CJ/7/Oem1rCX7zIJe+d+jLrVnVNQjENd3gqmANraLcdRWwnQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"chalk"
:
"^4.1.0"
,
"hash-sum"
:
"^2.0.0"
,
"loader-utils"
:
"^2.0.0"
},
"dependencies"
:
{
"ansi-styles"
:
{
"version"
:
"4.3.0"
,
"resolved"
:
"https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz"
,
"integrity"
:
"sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-convert"
:
"^2.0.1"
}
},
"chalk"
:
{
"version"
:
"4.1.0"
,
"resolved"
:
"https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz"
,
"integrity"
:
"sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"ansi-styles"
:
"^4.1.0"
,
"supports-color"
:
"^7.1.0"
}
},
"color-convert"
:
{
"version"
:
"2.0.1"
,
"resolved"
:
"https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz"
,
"integrity"
:
"sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-name"
:
"~1.1.4"
}
},
"color-name"
:
{
"version"
:
"1.1.4"
,
"resolved"
:
"https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz"
,
"integrity"
:
"sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
,
"dev"
:
true
,
"optional"
:
true
},
"has-flag"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz"
,
"integrity"
:
"sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
,
"dev"
:
true
,
"optional"
:
true
},
"loader-utils"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz"
,
"integrity"
:
"sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"big.js"
:
"^5.2.2"
,
"emojis-list"
:
"^3.0.0"
,
"json5"
:
"^2.1.2"
}
},
"supports-color"
:
{
"version"
:
"7.2.0"
,
"resolved"
:
"https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz"
,
"integrity"
:
"sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"has-flag"
:
"^4.0.0"
}
}
}
},
"vue-router"
:
{
"vue-router"
:
{
"version"
:
"3.4.9"
,
"version"
:
"3.4.9"
,
"resolved"
:
"https://registry.npmjs.org/vue-router/-/vue-router-3.4.9.tgz"
,
"resolved"
:
"https://registry.npmjs.org/vue-router/-/vue-router-3.4.9.tgz"
,
...
...
frontend/src/model/user.js
0 → 100644
View file @
1ccb4a74
// 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
=
{
token
:
""
,
id
:
0
}
module
.
exports
=
user
\ No newline at end of file
frontend/src/router/index.js
View file @
1ccb4a74
...
@@ -34,6 +34,11 @@ const routes = [
...
@@ -34,6 +34,11 @@ const routes = [
path
:
'/choixPartie'
,
path
:
'/choixPartie'
,
name
:
'ChoixPartie'
,
name
:
'ChoixPartie'
,
component
:
()
=>
import
(
/* webpackChunkName: "login" */
'../views/ChoixPartie.vue'
)
component
:
()
=>
import
(
/* webpackChunkName: "login" */
'../views/ChoixPartie.vue'
)
},
{
path
:
"/adminPrivate"
,
name
:
"AdminPrivate"
,
component
:
()
=>
import
(
/* webpackChunkName: "login" */
'../views/AdminPrivate.vue'
)
}
}
]
]
...
...
frontend/src/views/Accueil.vue
View file @
1ccb4a74
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
<
script
>
<
script
>
export
default
{
export
default
{
name
:
'Accueil'
,
name
:
'Accueil'
,
components
:
{
components
:
{
LoginNavbar
LoginNavbar
...
...
frontend/src/views/AdminPrivate.vue
View file @
1ccb4a74
...
@@ -3,15 +3,13 @@
...
@@ -3,15 +3,13 @@
<LoginNavbar></LoginNavbar>
<LoginNavbar></LoginNavbar>
<div
class=
"row _centered"
>
<div
class=
"row _centered"
>
<div
class=
"column _600"
>
<div
class=
"column _600"
>
<form
method=
"post"
class=
"startGame"
>
<div
class=
"codeGame"
>
<div
class=
"codeGame"
>
<label
class=
"titre"
>
Code de la partie :
</label
>
<h1
class=
"titre"
>
Code de la partie :
{{
returnID
()
}}
</h1
>
<!-- Choper le code de la partie privée --
>
<h1
class=
"titre"
id=
"codeGame"
>
{{
idGame
()
}}{{
returnID
()
}}
</h1
>
</div>
</div>
<div
class=
"joueurs"
>
<div
class=
"joueurs"
>
<!-- ajoute les joueurs présent -->
<!-- ajoute les joueurs présent -->
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -30,12 +28,32 @@
...
@@ -30,12 +28,32 @@
</
style
>
</
style
>
<
script
>
<
script
>
const
user
=
require
(
"../model/user.js"
)
export
default
{
export
default
{
name
:
'AdminPartie'
,
name
:
'AdminPrivate'
,
components
:
{
methods
:
{
LoginNavbar
idGame
:
function
(){
const
url
=
"http://localhost/felten/projet-cdaw/backend/MVC/api.php/game"
let
data
=
{
"GAME_DESC"
:
"testHTML"
}
}
}
import
LoginNavbar
from
'../components/LoginNavbar.vue'
var
params
=
{
method
:
'POST'
,
body
:
JSON
.
stringify
(
data
)
};
console
.
log
(
user
)
fetch
(
url
,
params
)
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
{
document
.
getElementById
(
"codeGame"
).
innerHTML
=
data
[
0
].
id
})
},
returnID
:
function
(){
return
user
.
id
}
},
}
</
script
>
</
script
>
\ No newline at end of file
frontend/src/views/ChoixPartie.vue
View file @
1ccb4a74
<
template
>
<
template
>
<div
class=
"page"
>
<div
class=
"page"
>
<LoginNavbar></LoginNavbar>
<LoginNavbar></LoginNavbar>
<tr
class=
"espaceHaut"
></tr>
<div
class =
"titre"
>
Veuillez choisir votre type de partie
</div>
<div
class =
"titre"
>
Veuillez choisir votre type de partie
</div>
<tr
class=
"espaceBas"
></tr>
<tr
class=
"espaceBas"
></tr>
<nav
class =
"choix-bouton"
>
<nav
class =
"choix-bouton"
>
...
@@ -81,8 +80,7 @@ export default {
...
@@ -81,8 +80,7 @@ export default {
name
:
'ChoixPartie'
,
name
:
'ChoixPartie'
,
components
:
{
components
:
{
LoginNavbar
LoginNavbar
}
},
}
}
import
LoginNavbar
from
'../components/LoginNavbar.vue'
import
LoginNavbar
from
'../components/LoginNavbar.vue'
</
script
>
</
script
>
\ No newline at end of file
frontend/src/views/Login.vue
View file @
1ccb4a74
...
@@ -74,6 +74,8 @@
...
@@ -74,6 +74,8 @@
</
style
>
</
style
>
<
script
>
<
script
>
const
user
=
require
(
"../model/user.js"
)
export
default
{
export
default
{
name
:
'Login'
,
name
:
'Login'
,
data
(
connect
){
// the data, declared as function
data
(
connect
){
// the data, declared as function
...
@@ -85,14 +87,14 @@ export default {
...
@@ -85,14 +87,14 @@ 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
,
hash
)
this
.
call
(
login
,
password
)
},
},
call
:
function
(
login
,
password
){
call
:
function
(
login
,
password
){
const
url
=
"http://localhost/projet-cdaw/backend/MVC/api.php/login"
const
url
=
"http://localhost/
felten/
projet-cdaw/backend/MVC/api.php/login"
let
data
=
{
let
data
=
{
login
:
login
,
login
:
login
,
...
@@ -102,24 +104,23 @@ export default {
...
@@ -102,24 +104,23 @@ export default {
var
params
=
{
var
params
=
{
method
:
'POST'
,
method
:
'POST'
,
body
:
JSON
.
stringify
(
data
)
};
body
:
JSON
.
stringify
(
data
)
};
fetch
(
url
,
params
)
fetch
(
url
,
params
)
.
then
(
response
=>
response
.
json
())
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
{
.
then
(
response
=>
{
sessionStorage
.
setItem
(
"JWT_TOKEN"
,
data
.
jwt_token
)
sessionStorage
.
setItem
(
"JWT_TOKEN"
,
response
.
data
.
jwt_token
)
console
.
log
(
sessionStorage
.
getItem
(
"JWT_TOKEN"
))
user
.
token
=
response
.
jwt_token
user
.
id
=
response
.
data
.
id
console
.
log
(
response
)
})
})
let
connect
=
false
console
.
log
(
connect
)
}
}
},
},
components
:
{
components
:
{
LoginNavbar
LoginNavbar
},
},
}
}
import
LoginNavbar
from
'../components/LoginNavbar.vue'
import
LoginNavbar
from
'../components/LoginNavbar.vue'
</
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