Skip to content
Snippets Groups Projects
Commit 19dda160 authored by George Andrinopoulos's avatar George Andrinopoulos
Browse files

Force new password after password reset via API

parent fabdcf81
No related branches found
No related tags found
No related merge requests found
---
title: Force new password after password reset via API
merge_request:
author: George Andrinopoulos
Loading
Loading
@@ -160,6 +160,8 @@ module API
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))
present user, with: Entities::UserPublic
else
Loading
Loading
Loading
Loading
@@ -305,6 +305,12 @@ describe API::Users, api: true do
expect(user.reload.bio).to eq('new test bio')
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
put api("/users/#{user.id}", admin), { organization: 'GitLab' }
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment