mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Fix tests
This commit is contained in:
parent
6057240888
commit
0b9a1005e5
1 changed files with 10 additions and 3 deletions
|
|
@ -26,7 +26,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
||||||
|
|
||||||
def after_sign_up_path_for(resource)
|
def after_sign_up_path_for(resource)
|
||||||
if @invitation&.family
|
if @invitation&.family
|
||||||
family_path(@invitation.family)
|
family_path
|
||||||
else
|
else
|
||||||
super(resource)
|
super(resource)
|
||||||
end
|
end
|
||||||
|
|
@ -34,7 +34,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
||||||
|
|
||||||
def after_inactive_sign_up_path_for(resource)
|
def after_inactive_sign_up_path_for(resource)
|
||||||
if @invitation&.family
|
if @invitation&.family
|
||||||
family_path(@invitation.family)
|
family_path
|
||||||
else
|
else
|
||||||
super(resource)
|
super(resource)
|
||||||
end
|
end
|
||||||
|
|
@ -43,7 +43,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
||||||
private
|
private
|
||||||
|
|
||||||
def check_registration_allowed
|
def check_registration_allowed
|
||||||
return unless DawarichSettings.self_hosted?
|
return unless self_hosted_mode?
|
||||||
return if valid_invitation_token?
|
return if valid_invitation_token?
|
||||||
|
|
||||||
redirect_to root_path,
|
redirect_to root_path,
|
||||||
|
|
@ -56,6 +56,13 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
||||||
@invitation = FamilyInvitation.find_by(token: invitation_token)
|
@invitation = FamilyInvitation.find_by(token: invitation_token)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self_hosted_mode?
|
||||||
|
env_value = ENV['SELF_HOSTED']
|
||||||
|
return ActiveModel::Type::Boolean.new.cast(env_value) unless env_value.nil?
|
||||||
|
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
def valid_invitation_token?
|
def valid_invitation_token?
|
||||||
@invitation&.can_be_accepted?
|
@invitation&.can_be_accepted?
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue