Commit 19dda160 authored by George Andrinopoulos's avatar George Andrinopoulos

Force new password after password reset via API

parent fabdcf81
---
title: Force new password after password reset via API
merge_request:
author: George Andrinopoulos
......@@ -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
......
......@@ -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' }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment