Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
0deacacf
Commit
0deacacf
authored
9 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
Fix staff password reset loop
parent
6ab58406
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/class.staff.php
+14
-7
14 additions, 7 deletions
include/class.staff.php
scp/profile.php
+1
-1
1 addition, 1 deletion
scp/profile.php
with
15 additions
and
8 deletions
include/class.staff.php
+
14
−
7
View file @
0deacacf
...
...
@@ -203,15 +203,15 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
throw
new
PasswordUpdateFailed
(
__
(
'Authentication backend does not support password updates'
));
}
if
(
!
$bk
->
setPassword
(
$this
,
$new
,
$current
))
{
// Backend should throw PasswordUpdateFailed directly
return
false
;
}
// Backend should throw PasswordUpdateFailed directly
$rv
=
$bk
->
setPassword
(
$this
,
$new
,
$current
);
// Successfully updated authentication tokens
$this
->
change_passwd
=
0
;
$this
->
cancelResetTokens
();
$this
->
passwdreset
=
SqlFunction
::
NOW
();
return
$rv
;
}
function
canAccess
(
$something
)
{
...
...
@@ -865,8 +865,6 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
elseif
(
!
$vars
[
'passwd1'
]
&&
!
$vars
[
'id'
])
{
$errors
[
'passwd1'
]
=
__
(
'Temporary password is required'
);
$errors
[
'temppasswd'
]
=
__
(
'Required'
);
}
elseif
(
$vars
[
'passwd1'
]
&&
strlen
(
$vars
[
'passwd1'
])
<
6
)
{
$errors
[
'passwd1'
]
=
__
(
'Password must be at least 6 characters'
);
}
}
...
...
@@ -915,8 +913,17 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
$this
->
signature
=
Format
::
sanitize
(
$vars
[
'signature'
]);
$this
->
notes
=
Format
::
sanitize
(
$vars
[
'notes'
]);
// Update the user's password if requested
if
(
$vars
[
'passwd1'
])
{
$this
->
passwd
=
Passwd
::
hash
(
$vars
[
'passwd1'
]);
try
{
$this
->
setPassword
(
$vars
[
'passwd1'
],
null
);
}
catch
(
BadPassword
$ex
)
{
$errors
[
'passwd1'
]
=
$ex
->
getMessage
();
}
catch
(
PasswordUpdateFailed
$ex
)
{
// TODO: Add a warning banner or crash the update
}
if
(
isset
(
$vars
[
'change_passwd'
]))
$this
->
change_passwd
=
1
;
}
...
...
This diff is collapsed.
Click to expand it.
scp/profile.php
+
1
−
1
View file @
0deacacf
...
...
@@ -25,7 +25,7 @@ if($_POST && $_POST['id']!=$thisstaff->getId()) { //Check dummy ID used on the f
if
(
!
$staff
)
$errors
[
'err'
]
=
sprintf
(
__
(
'%s: Unknown or invalid'
),
__
(
'agent'
));
elseif
(
$staff
->
updateProfile
(
$_POST
,
$errors
)){
elseif
(
$
this
staff
->
updateProfile
(
$_POST
,
$errors
)){
$msg
=
__
(
'Profile updated successfully'
);
}
elseif
(
!
$errors
[
'err'
])
$errors
[
'err'
]
=
__
(
'Profile update error. Try correcting the errors below and try again!'
);
...
...
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