Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchParapheur
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchParapheur
Commits
244a2f2b
Verified
Commit
244a2f2b
authored
3 years ago
by
Florian Azizian
Browse files
Options
Downloads
Patches
Plain Diff
FIX #16832 TIME 0:20 can change ws user password if no default connection enabled
parent
0974d0dd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/user/controllers/UserController.php
+6
-7
6 additions, 7 deletions
src/app/user/controllers/UserController.php
with
6 additions
and
7 deletions
src/app/user/controllers/UserController.php
+
6
−
7
View file @
244a2f2b
...
@@ -563,15 +563,16 @@ class UserController
...
@@ -563,15 +563,16 @@ class UserController
public
function
updatePassword
(
Request
$request
,
Response
$response
,
array
$args
)
public
function
updatePassword
(
Request
$request
,
Response
$response
,
array
$args
)
{
{
$connection
=
ConfigurationModel
::
getConnection
();
if
(
$connection
!=
'default'
)
{
return
$response
->
withStatus
(
403
)
->
withJson
([
'errors'
=>
'Privilege forbidden'
]);
}
if
(
!
Validator
::
intVal
()
->
notEmpty
()
->
validate
(
$args
[
'id'
]))
{
if
(
!
Validator
::
intVal
()
->
notEmpty
()
->
validate
(
$args
[
'id'
]))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Route id is not an integer'
]);
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Route id is not an integer'
]);
}
}
$user
=
UserModel
::
getById
([
'select'
=>
[
'login'
,
'"isRest"'
],
'id'
=>
$args
[
'id'
]]);
$connection
=
ConfigurationModel
::
getConnection
();
if
(
$connection
!=
'default'
&&
$user
[
'isRest'
]
==
false
)
{
return
$response
->
withStatus
(
403
)
->
withJson
([
'errors'
=>
'Privilege forbidden'
]);
}
if
(
$GLOBALS
[
'id'
]
!=
$args
[
'id'
])
{
if
(
$GLOBALS
[
'id'
]
!=
$args
[
'id'
])
{
if
(
!
PrivilegeController
::
hasPrivilege
([
'userId'
=>
$GLOBALS
[
'id'
],
'privilege'
=>
'manage_users'
]))
{
if
(
!
PrivilegeController
::
hasPrivilege
([
'userId'
=>
$GLOBALS
[
'id'
],
'privilege'
=>
'manage_users'
]))
{
return
$response
->
withStatus
(
403
)
->
withJson
([
'errors'
=>
'Privilege forbidden'
]);
return
$response
->
withStatus
(
403
)
->
withJson
([
'errors'
=>
'Privilege forbidden'
]);
...
@@ -585,8 +586,6 @@ class UserController
...
@@ -585,8 +586,6 @@ class UserController
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Body newPassword and passwordConfirmation must be identical'
]);
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Body newPassword and passwordConfirmation must be identical'
]);
}
}
$user
=
UserModel
::
getById
([
'select'
=>
[
'login'
,
'"isRest"'
],
'id'
=>
$args
[
'id'
]]);
if
(
$user
[
'isRest'
]
==
false
)
{
if
(
$user
[
'isRest'
]
==
false
)
{
if
(
empty
(
$body
[
'currentPassword'
])
||
!
AuthenticationModel
::
authentication
([
'login'
=>
$user
[
'login'
],
'password'
=>
$body
[
'currentPassword'
]]))
{
if
(
empty
(
$body
[
'currentPassword'
])
||
!
AuthenticationModel
::
authentication
([
'login'
=>
$user
[
'login'
],
'password'
=>
$body
[
'currentPassword'
]]))
{
return
$response
->
withStatus
(
401
)
->
withJson
([
'errors'
=>
'Wrong Password'
,
'lang'
=>
'wrongCurrentPassword'
]);
return
$response
->
withStatus
(
401
)
->
withJson
([
'errors'
=>
'Wrong Password'
,
'lang'
=>
'wrongCurrentPassword'
]);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment