App-MFILE-WWW

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.004  2014-08-13 03:37 CEST
- bin/dochazka-www: bring in server startup script from App-Dochazka-REST
  and adapt to our needs
- config/WWW_Config.pm: add some config params
- WWW.pm: bring in initialization routine from App-Dochazka-REST, adapt it, and
  call it from dochazka-www
- Resource.pm: eliminate large chunks of App-Dochazka-REST code that we don't
  need here; add debug messages; think through how requests will be validated
  by writing comments
- looking good overall -- the server starts and displays placeholder
  credentials dialog

0.005  2014-08-13 08:36 CEST
- change distro sharedir from 'config/' to 'share/', move config/ into it
- make a new 'comp/' subdir under share/, for Mason components
- make a new 'auth.mc' top-level Mason component for the credentials dialog
- WWW.pm: instantiate Mason interpreter and export it as $Mason singleton;
  load our distro sharedir instead of App-Dochazka-REST's; replace 
  placeholder auth dialog with one constructed by Mason on the fly from
  the template stored in 'share/comp/auth.mc'

0.006  2014-08-13 13:17 CEST
- Resource: add 'service_available' method for purpose of logging incoming
  HTTP requests, as it is the first method Web::Machine calls
- dochazka-cli: serve files in 'js/' and 'css/' directories statically using
  Plack::Middleware::Static

lib/App/MFILE/WWW/Resource.pm  view on Meta::CPAN

    if ( $r->method eq 'POST' and
         $self->context->{'request_body'} and
         $self->context->{'request_body'}->{'method'} and
         $self->context->{'request_body'}->{'method'} =~ m/^LOGIN/i ) {
        $log->debug( "is_authorized: Login attempt - pass it on" );
        return 1;
    }

    # bypass login dialog?
    if ( $site->MFILE_WWW_BYPASS_LOGIN_DIALOG ) {
        $log->warn( "Bypassing login dialog! Using default credentials" );
        #
        # since the credentials are set in the configuration file, we only
        # need to check them once - the result of this check is placed in
        # META_LOGIN_BYPASS_STATE
        #
        if ( not defined $meta->META_LOGIN_BYPASS_STATE ) {
            $meta->set('META_LOGIN_BYPASS_STATE', 0);
            $session->{'ip_addr'} = $remote_addr;
            $session->{'last_seen'} = time;
            my $bypass_status = $self->validate_user_credentials( {
                'nam' => $site->MFILE_WWW_DEFAULT_LOGIN_CREDENTIALS->{'nam'},
                'pwd' => $site->MFILE_WWW_DEFAULT_LOGIN_CREDENTIALS->{'pwd'},
            } );
            if ( $bypass_status->level() eq 'OK' ) {
                $meta->set('META_LOGIN_BYPASS_STATE', 1);
            }
        }
        return $meta->META_LOGIN_BYPASS_STATE;
    }

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.748 second using v1.00-cache-2.02-grep-82fe00e-cpan-f73e49a70403 )