<<

NAME

pf::Portal::Session

DESCRIPTION

pf::Portal::Session wraps several parameter we often need from the captive portal.

CONSTANTS

METHODS

new
_initialize
_restoreFromSession

Restore an item from the session if it does not exists compute the value

_initializeStash

Initialize a catalyst-style stash variable that is passed to the template when rendering.

_initializeI18n
_getDestinationUrl

Returns destination_url properly parsed, defended against XSS and with configured value if not defined.

_resolveIp

Returns the IP address of the client reaching the captive portal. Either directly connected or through a proxy.

stash

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.

getCgi

Returns the CGI object.

cgi

Returns the CGI object. Allows for more perl-ish syntax:

   $portalSession->cgi->param...
getSession

Returns the CGI::Session object.

session

Returns the CGI::Session object. Allows for more perl-ish syntax:

   $portalSession->session->param...
getClientIp

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.

setClientIp

Set the IP of the captive portal client

getClientMac

Returns the MAC of the captive portal client.

setClientMac

Set the MAC of the captive portal client

getGrantUrl

Returns the grant url where we have to forward the device

setGrantUrl

Set the grant url where we have to forward the client

getDestinationUrl

Returns the original destination URL requested by the client.

setDestinationUrl

Sets the destination url.

getProfile

Returns the proper captive portal profile for the current session.

getGuestNodeMac

Return the guest node mac address in the case of an email activation.

setGuestNodeMac

Sets the guest node mac address in the case of an email activation.

getTemplateIncludePath
getRequestLanguages

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)

getLanguages

Retrieve the user prefered languages from the following ordered sources:

1. the 'lang' URL parameter
2. the 'lang' parameter of the Web session
3. the browser accepted languages

If no language matches the authorized locales from the configuration, the first locale of the configuration is returned.

AUTHOR

Inverse inc. <info@inverse.ca>

COPYRIGHT

Copyright (C) 2005-2015 Inverse inc.

LICENSE

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.

<<