Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use source from profile if none is set in Module. #8439

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -171,6 +175,11 @@ sub auth_source_params_child {
};
}

sub _build_source {
my ($self) = @_;
return $self->app->profile->getSourceByType('Email');
}

=head1 AUTHOR

Inverse inc. <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -328,6 +332,11 @@ sub auth_source_params_child {
};
}

sub _build_source {
my ($self) = @_;
return $self->app->profile->getSourceByType('SMS');
}

=head1 AUTHOR

Inverse inc. <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -313,6 +317,11 @@ sub auth_source_params_child {
};
}

sub _build_source {
my ($self) = @_;
return $self->app->profile->getSourceByType('SponsorEmail');
}

=head1 AUTHOR

Inverse inc. <[email protected]>
Expand Down
Loading