pf::Portal::Session
pf::Portal::Session wraps several parameter we often need from the captive portal.
Restore an item from the session if it does not exists compute the value
Initialize a catalyst-style stash variable that is passed to the template when rendering.
Returns destination_url properly parsed, defended against XSS and with configured value if not defined.
Returns the IP address of the client reaching the captive portal. Either directly connected or through a proxy.
Initialize a catalyst-style stash variable that is passed to the template when rendering. Use it like that:
$portalSession->stash->{'username'} = encode_entities($cgi->param("username"));
and then username in the template will be set with the proper values.
One can also use a syntax like this:
$portalSession->stash( { 'username' => encode_entities($cgi->param("username")) } );
Also, it is prepopulated with the Web constants from pf::web::constants.
Returns the CGI object.
Returns the CGI object. Allows for more perl-ish syntax:
$portalSession->cgi->param...
Returns the CGI::Session object.
Returns the CGI::Session object. Allows for more perl-ish syntax:
$portalSession->session->param...
Returns the IP of the client behind the captive portal. We do proper header lookups for Proxy bypass and load balancers instead of looking at local TCP from CGI.
Set the IP of the captive portal client
Returns the MAC of the captive portal client.
Set the MAC of the captive portal client
Returns the grant url where we have to forward the device
Set the grant url where we have to forward the client
Returns the original destination URL requested by the client.
Sets the destination url.
Returns the proper captive portal profile for the current session.
Return the guest node mac address in the case of an email activation.
Sets the guest node mac address in the case of an email activation.
Extract the preferred languages from the HTTP request. Ex: Accept-Language: en-US,en;q=0.8,fr;q=0.6,fr-CA;q=0.4,no;q=0.2,es;q=0.2 will return qw(en_US en fr fr_CA no es)
Retrieve the user prefered languages from the following ordered sources:
If no language matches the authorized locales from the configuration, the first locale of the configuration is returned.
Inverse inc. <info@inverse.ca>
Copyright (C) 2005-2015 Inverse inc.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.