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
5c14292c
Commit
5c14292c
authored
Dec 03, 2020
by
Zohten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
verif pseudo backend
parent
a8aa0e71
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
UserController.class.php
BackEnd/src/controller/UserController.class.php
+6
-0
User.class.php
BackEnd/src/model/User.class.php
+6
-0
User.sql.php
BackEnd/src/sql/User.sql.php
+5
-0
No files found.
BackEnd/src/controller/UserController.class.php
View file @
5c14292c
...
...
@@ -116,6 +116,12 @@ class UserController extends Controller
return
new
Response
(
422
,
$message
);
}
// Check if login/pseudo is already used
if
(
User
::
checkLogin
(
$array
[
'login'
]))
{
$message
=
json_encode
([
"message"
=>
'This pseudo is already used'
]);
return
new
Response
(
422
,
$message
);
}
// Fill facultative field
if
(
!
isset
(
$array
[
'avatar'
])){
$array
[
'avatar'
]
=
''
;
...
...
BackEnd/src/model/User.class.php
View file @
5c14292c
...
...
@@ -35,6 +35,12 @@ class User extends Model
$stm
=
parent
::
exec
(
'USER_UPDATE'
,
$array
);
}
public
static
function
checkLogin
(
$login
)
{
$stm
=
parent
::
exec
(
'USER_CHECK_LOGIN'
,
[
'login'
=>
$login
]);
return
$stm
->
fetch
();
}
public
static
function
tryLogin
(
$login
)
{
$stm
=
parent
::
exec
(
'USER_GET_WITH_LOGIN'
,
[
'login'
=>
$login
]);
...
...
BackEnd/src/sql/User.sql.php
View file @
5c14292c
...
...
@@ -5,6 +5,11 @@ User::addSqlQuery(
'SELECT * FROM MJ_USER ORDER BY LOGIN'
);
User
::
addSqlQuery
(
'USER_CHECK_LOGIN'
,
'SELECT LOGIN FROM MJ_USER WHERE LOGIN=:login'
);
User
::
addSqlQuery
(
'USER_GET_WITH_LOGIN'
,
'SELECT * FROM MJ_USER WHERE LOGIN=: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