I did something very similar. I added validation to the phone field by
modifying
/usr/local/pf/html/captive-portal/lib/captiveportal/Form/Authentication.pm. The
entry is now restricted to 10 digits without dashes.
The my %skip hash should look like this:
my %skip = (
email => 1,
telephone => 1,
map { $_ => 1 } @pf::person::NON_PROMPTABLE_FIELDS,
);
I added this line above the mobilprovider line:
has_field 'fields[telephone]' => (label => 'Telephone', apply => [{ check =>
qr/^[2-9]{2}[0-9]{8}$/, message => 'Must be 10 digits (without dashes)' } ] );
This is very close to what you want. I’m not sure how to get the “tel” type to
work. Adding telephone to the skip hash lets you configure the field manually.
These links might help.
http://search.cpan.org/~gshank/HTML-FormHandler-0.40066/lib/HTML/FormHandler.pm
http://search.cpan.org/~gshank/HTML-FormHandler-0.40056/lib/HTML/FormHandler/Manual/Defaults.pod
From: David Murrell [mailto:[email protected]]
Sent: Monday, September 5, 2016 6:09 PM
To: [email protected]
Subject: Re: [PacketFence-users] phone number in SMS registration
Hi,
> filter it to standardize the number format?
On mobile, its possible to specify the type of keyboard that's shown. It seems
that having better keyboards on mobile devices seems to lead to better input,
too.
I'll resurrect this thread from the dead - on mobile devices, if the field type
is set to tel, it brings up a telephone only dialer input interface.
I submitted a pull request for pf 5.x to tidy it up, but it seems to have got
thrown out with the new interface:
https://github.com/inverse-inc/packetfence/pull/1180/commits/f550324a2acfdfc09fa257a57d4cb774cb5f77aa
I can't quite figure out how to make this new version do the same.
If in
/usr/local/pf/html/captive-portal/lib/captiveportal/Form/Authentication.pm
line 42
From this:
has_field 'fields[telephone]' => (type => "Text", label => "Telephone");
To this:
has_field 'fields[telephone]' => (type => "tel", label => "Telephone");
I get this exception:
Caught exception in captiveportal::Controller::Root->dynamic_application "Could
not load field class 'tel' for field 'fields[telephone]' at
/usr/share/perl5/vendor_perl/HTML/FormHandler/BuildFields.pm line 214."
Any thoughts?
Cheers,
David Murrell
Systems Engineer
University of Waikato
On Fri, Aug 5, 2016 at 8:57 AM, Morgan, Joel P.
<[email protected]<mailto:[email protected]>> wrote:
I added validation to the phone field by modifying
/usr/local/pf/html/captive-portal/lib/captiveportal/Form/Authentication.pm. The
entry is now restricted to 10 digits without dashes.
The my %skip hash should look like this:
my %skip = (
email => 1,
telephone => 1,
map { $_ => 1 } @pf::person::NON_PROMPTABLE_FIELDS,
);
I added this line above the mobilprovider line:
has_field 'fields[telephone]' => (label => 'Telephone', apply => [{ check =>
qr/^[2-9]{2}[0-9]{8}$/, message => 'Must be 10 digits (without dashes)' } ] );
From: Morgan, Joel P.
Sent: Wednesday, August 3, 2016 6:12 PM
To:
[email protected]<mailto:[email protected]>
Subject: [PacketFence-users] phone number in SMS registration
I’m running Packetfence 6.2 on CentOS 6.8.
I noticed that when entering a phone number in the SMS registration screen,
both ###-###-#### and ########## formats for a phone number are accepted. One
phone number registered in each format creates two different user accounts. Is
there a way to validate the input, or filter it to standardize the number
format?
------------------------------------------------------------------------------
_______________________________________________
PacketFence-users mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/packetfence-users
------------------------------------------------------------------------------
_______________________________________________
PacketFence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users