diff --git a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication.pm b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication.pm
index f5cd419e2c9c..f4cffbe0e10d 100644
--- a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication.pm
+++ b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication.pm
@@ -29,7 +29,7 @@ use pf::constants::role qw($REJECT_ROLE);
has 'source' => (is => 'rw', isa => 'pf::Authentication::Source|Undef');
-has 'source_id' => (is => 'rw', trigger => \&_build_source);
+has 'source_id' => (is => 'rw', trigger => \&_rebuild_source);
has 'required_fields' => (is => 'rw', isa => 'ArrayRef[Str]', builder => '_build_required_fields', lazy => 1);
@@ -129,13 +129,13 @@ sub _build_request_fields {
return \%request_fields;
}
-=head2 _build_source
+=head2 _rebuild_source
Builder for the source using the source_id attribute
=cut
-sub _build_source {
+sub _rebuild_source {
my ($self) = @_;
$self->source(pf::authentication::getAuthenticationSource($self->{source_id}));
}
diff --git a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/Email.pm b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/Email.pm
index 4e1f74b0fd93..d632933b7411 100644
--- a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/Email.pm
+++ b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/Email.pm
@@ -14,7 +14,11 @@ use Moose;
extends 'captiveportal::DynamicRouting::Module::Authentication';
with 'captiveportal::Role::FieldValidation';
-has '+source' => (isa => 'pf::Authentication::Source::EmailSource');
+has '+source' => (
+ isa => 'pf::Authentication::Source::EmailSource',
+ lazy => 1,
+ builder => '_build_source',
+);
use pf::auth_log;
use pf::config qw(%Config);
@@ -171,6 +175,11 @@ sub auth_source_params_child {
};
}
+sub _build_source {
+ my ($self) = @_;
+ return $self->app->profile->getSourceByType('Email');
+}
+
=head1 AUTHOR
Inverse inc.
diff --git a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/SMS.pm b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/SMS.pm
index 61ef09b8bd64..f07db5868d7a 100644
--- a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/SMS.pm
+++ b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/SMS.pm
@@ -24,7 +24,11 @@ use pf::auth_log;
has '+pid_field' => (default => sub { "telephone" });
-has '+source' => (isa => 'pf::Authentication::Source::SMSSource|pf::Authentication::Source::TwilioSource|pf::Authentication::Source::ClickatellSource');
+has '+source' => (
+ isa => 'pf::Authentication::Source::SMSSource|pf::Authentication::Source::TwilioSource|pf::Authentication::Source::ClickatellSource',
+ lazy => 1,
+ builder => '_build_source',
+);
=head2 allowed_urls_auth_module
@@ -328,6 +332,11 @@ sub auth_source_params_child {
};
}
+sub _build_source {
+ my ($self) = @_;
+ return $self->app->profile->getSourceByType('SMS');
+}
+
=head1 AUTHOR
Inverse inc.
diff --git a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/Sponsor.pm b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/Sponsor.pm
index 1fe11b719763..2da80a52caf6 100644
--- a/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/Sponsor.pm
+++ b/html/captive-portal/lib/captiveportal/PacketFence/DynamicRouting/Module/Authentication/Sponsor.pm
@@ -29,7 +29,11 @@ use captiveportal::Base::Actions;
use pf::nodecategory;
use pf::util;
-has '+source' => (isa => 'pf::Authentication::Source::SponsorEmailSource');
+has '+source' => (
+ isa => 'pf::Authentication::Source::SponsorEmailSource',
+ lazy => 1,
+ builder => '_build_source',
+);
has 'forced_sponsor' => ('is' => 'rw');
@@ -313,6 +317,11 @@ sub auth_source_params_child {
};
}
+sub _build_source {
+ my ($self) = @_;
+ return $self->app->profile->getSourceByType('SponsorEmail');
+}
+
=head1 AUTHOR
Inverse inc.