debian-mirror-gitlab/app/services/users/create_service.rb

21 lines
517 B
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
module Users
class CreateService < BaseService
2017-09-10 17:25:29 +05:30
include NewUserNotifier
2017-08-17 22:00:37 +05:30
def initialize(current_user, params = {})
@current_user = current_user
@params = params.dup
end
def execute(skip_authorization: false)
user = Users::BuildService.new(current_user, params).execute(skip_authorization: skip_authorization)
@reset_token = user.generate_reset_token if user.recently_sent_password_reset?
2017-09-10 17:25:29 +05:30
notify_new_user(user, @reset_token) if user.save
2017-08-17 22:00:37 +05:30
user
end
end
end