|
|
@ -299,20 +299,19 @@ class AccountController < ApplicationController |
|
|
|
def registration_through_invitation! |
|
|
|
def registration_through_invitation! |
|
|
|
session[:auth_source_registration] = nil |
|
|
|
session[:auth_source_registration] = nil |
|
|
|
|
|
|
|
|
|
|
|
if @user.nil? |
|
|
|
@user = Users::SetAttributesService.new( |
|
|
|
@user = User.new(language: Setting.default_language) |
|
|
|
model: @user || User.new, user: current_user, |
|
|
|
elsif user_with_placeholder_name?(@user) |
|
|
|
contract_class: @user.nil? ? Users::CreateContract : Users::UpdateContract |
|
|
|
# force user to give their name |
|
|
|
).call(@user.nil? ? { language: Setting.default_language } : { firstname: nil, lastname: nil }) |
|
|
|
@user.firstname = nil |
|
|
|
.result |
|
|
|
@user.lastname = nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def self_registration! |
|
|
|
def self_registration! |
|
|
|
if @user.nil? |
|
|
|
if @user.nil? |
|
|
|
@user = User.new |
|
|
|
@user = Users::SetAttributesService |
|
|
|
@user.admin = false |
|
|
|
.new(model: User.new, user: current_user, contract_class: Users::CreateContract) |
|
|
|
@user.register |
|
|
|
.call(admin: false, status: User.statuses[:registered]) |
|
|
|
|
|
|
|
.result |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
return if enforce_activation_user_limit(user: user_with_email(@user)) |
|
|
|
return if enforce_activation_user_limit(user: user_with_email(@user)) |
|
|
|