Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
19dda160
Commit
19dda160
authored
Feb 02, 2017
by
George Andrinopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force new password after password reset via API
parent
fabdcf81
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
0 deletions
+12
-0
changelogs/unreleased/24606-force-password-reset-on-next-login.yml
...s/unreleased/24606-force-password-reset-on-next-login.yml
+4
-0
lib/api/users.rb
lib/api/users.rb
+2
-0
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+6
-0
No files found.
changelogs/unreleased/24606-force-password-reset-on-next-login.yml
0 → 100644
View file @
19dda160
---
title
:
Force new password after password reset via API
merge_request
:
author
:
George Andrinopoulos
lib/api/users.rb
View file @
19dda160
...
@@ -160,6 +160,8 @@ module API
...
@@ -160,6 +160,8 @@ module API
end
end
end
end
user_params
.
merge!
(
password_expires_at:
Time
.
now
)
if
user_params
[
:password
].
present?
if
user
.
update_attributes
(
user_params
.
except
(
:extern_uid
,
:provider
))
if
user
.
update_attributes
(
user_params
.
except
(
:extern_uid
,
:provider
))
present
user
,
with:
Entities
::
UserPublic
present
user
,
with:
Entities
::
UserPublic
else
else
...
...
spec/requests/api/users_spec.rb
View file @
19dda160
...
@@ -305,6 +305,12 @@ describe API::Users, api: true do
...
@@ -305,6 +305,12 @@ describe API::Users, api: true do
expect
(
user
.
reload
.
bio
).
to
eq
(
'new test bio'
)
expect
(
user
.
reload
.
bio
).
to
eq
(
'new test bio'
)
end
end
it
"updates user with new password and forces reset on next login"
do
put
api
(
"/users/
#{
user
.
id
}
"
,
admin
),
{
password:
'12345678'
}
expect
(
response
).
to
have_http_status
(
200
)
expect
(
user
.
reload
.
password_expires_at
).
to
be
<
Time
.
now
end
it
"updates user with organization"
do
it
"updates user with organization"
do
put
api
(
"/users/
#{
user
.
id
}
"
,
admin
),
{
organization:
'GitLab'
}
put
api
(
"/users/
#{
user
.
id
}
"
,
admin
),
{
organization:
'GitLab'
}
...
...
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