Commit 4dd841c9 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix-password-required-check' into 'master'

Inlude the password_automatically_check param as permitted config in the user create_service

Closes #30335

See merge request !10386
parents 050bafaa a766f60a
......@@ -62,6 +62,7 @@ module Users
:email,
:external,
:force_random_password,
:password_automatically_set,
:hide_no_password,
:hide_no_ssh_key,
:key_id,
......@@ -85,6 +86,7 @@ module Users
[
:email,
:email_confirmation,
:password_automatically_set,
:name,
:password,
:username
......
......@@ -40,6 +40,15 @@ describe Gitlab::OAuth::User, lib: true do
let(:provider) { 'twitter' }
describe 'signup' do
it 'marks user as having password_automatically_set' do
stub_omniauth_config(allow_single_sign_on: ['twitter'], external_providers: ['twitter'])
oauth_user.save
expect(gl_user).to be_persisted
expect(gl_user).to be_password_automatically_set
end
shared_examples 'to verify compliance with allow_single_sign_on' do
context 'provider is marked as external' do
it 'marks user as external' do
......
......@@ -122,6 +122,32 @@ describe Users::CreateService, services: true do
end
end
context 'when password_automatically_set parameter is true' do
let(:params) do
{
name: 'John Doe',
username: 'jduser',
email: 'jd@example.com',
password: 'mydummypass',
password_automatically_set: true
}
end
it 'persists the given attributes' do
user = service.execute
user.reload
expect(user).to have_attributes(
name: params[:name],
username: params[:username],
email: params[:email],
password: params[:password],
created_by_id: admin_user.id,
password_automatically_set: params[:password_automatically_set]
)
end
end
context 'when skip_confirmation parameter is true' do
let(:params) do
{ name: 'John Doe', username: 'jduser', email: 'jd@example.com', password: 'mydummypass', skip_confirmation: true }
......
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