BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
3e10797d
Commit
3e10797d
authored
Apr 26, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix logic in Users::CreateService broken by the fix for OAuth users
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
03940fb1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
create_service.rb
app/services/users/create_service.rb
+15
-8
No files found.
app/services/users/create_service.rb
View file @
3e10797d
...
...
@@ -9,14 +9,13 @@ module Users
def
build
(
skip_authorization:
false
)
raise
Gitlab
::
Access
::
AccessDeniedError
unless
skip_authorization
||
can_create_user?
user
=
User
.
new
(
build_user_params
(
skip_authorization:
skip_authorization
))
user_params
=
build_user_params
(
skip_authorization:
skip_authorization
)
user
=
User
.
new
(
user_params
)
if
current_user
&
.
admin?
if
params
[
:reset_password
]
@reset_token
=
user
.
generate_reset_token
end
@reset_token
=
user
.
generate_reset_token
if
params
[
:reset_password
]
if
params
[
:force_random_password
]
if
user_
params
[
:force_random_password
]
random_password
=
Devise
.
friendly_token
.
first
(
Devise
.
password_length
.
min
)
user
.
password
=
user
.
password_confirmation
=
random_password
end
...
...
@@ -101,12 +100,20 @@ module Users
user_params
.
merge!
(
force_random_password:
true
,
password_expires_at:
nil
)
end
else
user_params
=
params
.
slice
(
*
signup_params
)
user_params
[
:skip_confirmation
]
=
params
[
:skip_confirmation
]
if
skip_authorization
user_params
[
:skip_confirmation
]
||=
!
current_application_settings
.
send_user_confirmation_email
allowed_signup_params
=
signup_params
allowed_signup_params
<<
:skip_confirmation
if
skip_authorization
user_params
=
params
.
slice
(
*
allowed_signup_params
)
if
user_params
[
:skip_confirmation
].
nil?
user_params
[
:skip_confirmation
]
=
skip_user_confirmation_email_from_setting
end
end
user_params
end
def
skip_user_confirmation_email_from_setting
!
current_application_settings
.
send_user_confirmation_email
end
end
end
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