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
1
Issues
1
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
Quentin Vrel
projet-cdaw
Commits
543be5ee
Commit
543be5ee
authored
Dec 01, 2020
by
Zohten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
banned account gestion
parent
c337abc3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
LoginController.class.php
BackEnd/src/controller/LoginController.class.php
+6
-0
User.class.php
BackEnd/src/model/User.class.php
+1
-0
userRequests.http
BackEnd/src/testRequests/userRequests.http
+8
-0
No files found.
BackEnd/src/controller/LoginController.class.php
View file @
543be5ee
...
@@ -25,6 +25,12 @@ class LoginController extends Controller
...
@@ -25,6 +25,12 @@ class LoginController extends Controller
}
}
$user
=
User
::
tryLogin
(
$json
[
'login'
]);
$user
=
User
::
tryLogin
(
$json
[
'login'
]);
if
(
$user
->
isBanned
()
==
1
){
$message
=
json_encode
([
"message"
=>
"Your account is banned!"
]);
return
Response
::
unauthorizedResponse
(
$message
);
}
if
(
empty
(
$user
)
||
!
hash_equals
(
$json
[
'pwd'
],
$user
->
password
()))
{
if
(
empty
(
$user
)
||
!
hash_equals
(
$json
[
'pwd'
],
$user
->
password
()))
{
$r
=
new
Response
(
422
,
"wrong credentials"
);
$r
=
new
Response
(
422
,
"wrong credentials"
);
$r
->
send
();
$r
->
send
();
...
...
BackEnd/src/model/User.class.php
View file @
543be5ee
...
@@ -40,6 +40,7 @@ class User extends Model
...
@@ -40,6 +40,7 @@ class User extends Model
$stm
=
parent
::
exec
(
'USER_GET_WITH_LOGIN'
,
[
'login'
=>
$login
]);
$stm
=
parent
::
exec
(
'USER_GET_WITH_LOGIN'
,
[
'login'
=>
$login
]);
return
$stm
->
fetch
();
return
$stm
->
fetch
();
}
}
public
function
id
()
public
function
id
()
{
{
return
trim
(
$this
->
ID_USER
);
return
trim
(
$this
->
ID_USER
);
...
...
BackEnd/src/testRequests/userRequests.http
View file @
543be5ee
...
@@ -12,6 +12,14 @@ POST http://localhost/index.php/login
...
@@ -12,6 +12,14 @@ POST http://localhost/index.php/login
"pwd": "hasheddupontpwd"
"pwd": "hasheddupontpwd"
}
}
### Tenter de récupérer un token utilisateur bloqué
POST http://localhost/index.php/login
{
"login": "kevinlekikou",
"pwd": "hashedkevinlekikoupwd"
}
### Récupérer un token admin
### Récupérer un token admin
POST http://localhost/index.php/login
POST http://localhost/index.php/login
...
...
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