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
Raphaël PEIM
projet-cdaw
Commits
c2820a9c
Commit
c2820a9c
authored
Dec 01, 2020
by
raphael.peim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify classnames
parent
109dd0b0
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
110 additions
and
33 deletions
+110
-33
LoginController.class.php
frontend/public/api/controller/LoginController.class.php
+2
-1
Navbar.vue
frontend/src/components/Navbar.vue
+3
-1
main.js
frontend/src/main.js
+28
-1
Game.vue
frontend/src/views/Game.vue
+30
-2
GameChoice.vue
frontend/src/views/GameChoice.vue
+1
-1
GameCreate.vue
frontend/src/views/GameCreate.vue
+1
-1
GameJoin.vue
frontend/src/views/GameJoin.vue
+9
-3
Home.vue
frontend/src/views/Home.vue
+9
-3
Index.vue
frontend/src/views/Index.vue
+24
-17
Rules.vue
frontend/src/views/Rules.vue
+1
-1
Signup.vue
frontend/src/views/Signup.vue
+1
-1
Waiting.vue
frontend/src/views/Waiting.vue
+1
-1
No files found.
frontend/public/api/controller/LoginController.class.php
View file @
c2820a9c
...
...
@@ -38,10 +38,11 @@
"iat"
=>
$issued_at
,
"exp"
=>
$expiration_time
,
"iss"
=>
JWT_ISSUER
,
"data"
=>
array
(
"id"
=>
$user
->
id
,
"data"
=>
array
(
"firstname"
=>
$user
->
firstname
,
"lastname"
=>
$user
->
lastname
,
"lastname"
=>
$user
->
login
,
"email"
=>
$user
->
email
)
);
...
...
frontend/src/components/Navbar.vue
View file @
c2820a9c
...
...
@@ -39,10 +39,12 @@
components
:
{},
methods
:
{
onClick
()
{
if
(
confirm
(
"Etes-vous sûr de vouloir vous déconnecter ?"
))
if
(
confirm
(
"Etes-vous sûr de vouloir vous déconnecter ?"
))
{
localStorage
.
clear
()
window
.
location
.
href
=
'/#/'
}
}
}
};
</
script
>
...
...
frontend/src/main.js
View file @
c2820a9c
...
...
@@ -11,7 +11,34 @@ Vue.use(BootstrapVue)
Vue
.
config
.
productionTip
=
false
Vue
.
prototype
.
$hostname
=
Vue
.
config
.
productionTip
?
'https://hostname'
:
'http://localhost:8080'
Vue
.
prototype
.
$apiUrl
=
'http://localhost:8888/IMT/CDAW/frontend/public/api/api.php'
Vue
.
prototype
.
$token
=
""
Vue
.
mixin
({
created
:
function
()
{
if
(
localStorage
.
token
===
undefined
&&
this
.
$route
.
name
!=
'Index'
&&
this
.
$route
.
name
!=
'Signup'
)
{
window
.
location
.
href
=
'/#/'
}
else
if
(
localStorage
.
token
!==
undefined
&&
(
this
.
$route
.
name
==
'Index'
||
this
.
$route
.
name
==
'Signup'
))
{
window
.
location
.
href
=
'/#/home'
}
},
methods
:
{
isExpired
()
{
fetch
(
this
.
$apiUrl
+
'/validatetoken'
,
{
method
:
'GET'
,
header
:
{
'Authorization'
:
'Bearer '
+
localStorage
.
token
}
})
.
then
(
response
=>
{
if
(
response
.
status
===
200
)
{
return
false
}
else
{
window
.
location
.
href
=
'/#/'
}
})
}
}
})
new
Vue
({
router
,
...
...
frontend/src/views/Game.vue
View file @
c2820a9c
...
...
@@ -2,7 +2,15 @@
<div
class=
"body"
>
<Navbar/>
<div
class=
"center"
>
<img
src=
"../assets/img/game.png"
class=
"img-fluid"
alt=
"Responsive image"
>
<!--
<img
src=
"../assets/img/game.png"
class=
"img-fluid"
alt=
"Responsive image"
>
-->
<div
id=
"game"
class=
"container"
>
<div
class=
"row"
>
<div
id=
"chat"
class=
"col-4"
>
</div>
<div
id=
"play"
class=
"col-10"
>
</div>
</div>
</div>
</div>
</div>
</
template
>
...
...
@@ -17,3 +25,23 @@
}
}
</
script
>
<
style
>
#game
{
display
:
flex
;
height
:
50px
;
border
:
1px
solid
black
;
}
#chat
{
/* display: flex; */
/* width: 20%; */
height
:
50px
;
border
:
1px
solid
black
;
}
#play
{
/* display: flex; */
/* width: 80%; */
height
:
50px
;
border
:
1px
solid
black
;
}
</
style
>
\ No newline at end of file
frontend/src/views/GameChoice.vue
View file @
c2820a9c
<
template
>
<div
class=
"body"
>
<Navbar/>
<div
class=
"center"
>
<div
class=
"c
ontainer d-flex justify-content-c
enter"
>
<div
class=
"card shadow mb-4"
>
<h5
class=
"card-header text-primary"
>
Choisissez le mode
</h5>
<div
class=
"card-body"
style=
"width : 500px;"
>
...
...
frontend/src/views/GameCreate.vue
View file @
c2820a9c
<
template
>
<div
class=
"body"
>
<Navbar/>
<div
class=
"center"
>
<div
class=
"c
ontainer d-flex justify-content-c
enter"
>
<div
class=
"card shadow mb-4"
>
<h5
class=
"card-header text-primary"
>
Créer une partie
</h5>
<div
class=
"card-body"
style=
"width : 500px;"
>
...
...
frontend/src/views/GameJoin.vue
View file @
c2820a9c
<
template
>
<div
class=
"body"
>
<Navbar/>
<div
class=
"center"
>
<div
class=
"c
ontainer d-flex justify-content-c
enter"
>
<div
class=
"card shadow mb-4"
>
<h5
class=
"card-header text-primary"
>
Rejoindre une partie
</h5>
<div
class=
"card-body"
style=
"width : 500px;"
>
...
...
@@ -12,7 +12,7 @@
<button
type=
"button"
class=
"btn btn-primary btn-block"
>
Commencer
</button>
</router-link>
</form>
<form
style=
"margin-top: 50px;"
>
<form>
<h5>
Sans identifiant :
</h5>
<router-link
to=
"/game"
>
<button
type=
"button"
class=
"btn btn-primary btn-block"
>
Trouver une partie
</button>
...
...
@@ -41,3 +41,9 @@
}
}
</
script
>
<
style
>
form
:nth-of-type
(
2
)
{
margin-top
:
50px
;
}
</
style
>
\ No newline at end of file
frontend/src/views/Home.vue
View file @
c2820a9c
<
template
>
<div
class=
"body"
>
<Navbar/>
<div
class=
"center"
style=
"justify-content: space-around;"
>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col d-flex justify-content-center"
>
<router-link
to=
"/rules"
><b-button
variant=
"primary"
>
Découvrir le mahjong
</b-button></router-link>
</div>
<div
class=
"col d-flex justify-content-center"
>
<router-link
to=
"/gameChoice"
><b-button
variant=
"primary"
>
Commercer à jouer
</b-button></router-link>
</div>
</div>
</div>
</div>
</
template
>
<
script
>
...
...
frontend/src/views/Index.vue
View file @
c2820a9c
...
...
@@ -77,8 +77,11 @@
let
areEqual
=
bcrypt
.
compareSync
(
form
.
elements
.
password
.
value
,
row
.
password
)
if
(
areEqual
)
{
this
.
getToken
(
row
.
login
,
row
.
password
)
// Enregistrement du token et redirection
this
.
getToken
(
row
.
login
,
row
.
password
).
then
(
token
=>
{
localStorage
.
setItem
(
'token'
,
token
)
window
.
location
.
href
=
"/#/home"
});
}
else
{
document
.
querySelector
(
'#message'
).
innerHTML
=
"Mauvais mot de passe"
...
...
@@ -92,6 +95,7 @@
});
},
getToken
(
login
,
password
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
fetch
(
this
.
$apiUrl
+
'/login'
,
{
method
:
'POST'
,
body
:
JSON
.
stringify
({
login
:
login
,
password
:
password
})
...
...
@@ -104,10 +108,13 @@
}
})
.
then
(
data
=>
{
console
.
log
(
data
.
jwt_token
)
// Envoie du token
resolve
(
data
.
jwt_token
)
}).
catch
(
error
=>
{
console
.
error
(
error
)
console
.
error
(
reject
)
});
})
}
}
}
...
...
frontend/src/views/Rules.vue
View file @
c2820a9c
<
template
>
<div
class=
"body"
>
<Navbar/>
<div
class=
"center"
>
<div
class=
"c
ontainer d-flex justify-content-c
enter"
>
<h1>
Les règles
</h1>
</div>
</div>
...
...
frontend/src/views/Signup.vue
View file @
c2820a9c
...
...
@@ -4,7 +4,7 @@
<div
class=
"card-body p-0"
>
<div
class=
"row"
>
<div
class=
"col-lg-6 d-none d-lg-block bg-login-image"
>
<img
src=
"../assets/img/log.png"
class=
"img-fluid"
alt=
"Responsive image"
>
<img
src=
"../assets/img/log.png"
class=
"img-fluid
h-100 d-inline-block
"
alt=
"Responsive image"
>
</div>
<div
class=
"col-lg-6"
>
<div
class=
"p-5"
>
...
...
frontend/src/views/Waiting.vue
View file @
c2820a9c
<
template
>
<div
class=
"body"
>
<Navbar/>
<div
class=
"center"
>
<div
class=
"c
ontainer d-flex justify-content-c
enter"
>
<div
class=
"card shadow mb-4"
>
<h5
class=
"card-header text-primary"
>
En attente de joueurs
</h5>
<div
class=
"card-body"
style=
"width : 500px;"
>
...
...
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