Result:
found 106 distributions and 303 files matching your query ! ( run in 1.222 )


Mojolicious-Command-generate-bootstrap_app

 view release on metacpan or  search on metacpan

lib/Mojolicious/Command/generate/bootstrap_app.pm  view on Meta::CPAN

sub create {
    my $self = shift;

    my $record = {};

    if ($self->_validate_form){
        $record->{login} = $self->_trim($self->param('login'));
        $record->{email}    = $self->_trim($self->param('email'));
        $record->{password} = $self->_encrypt_password($self->param('password'));
        $record->{admin}    = $self->param('admin') ? 1 : 0;

lib/Mojolicious/Command/generate/bootstrap_app.pm  view on Meta::CPAN

sub update {
    my $self = shift;

    my $record = {};

    if ($self->_validate_form){
        $record->{login} = $self->_trim($self->param('login'));
        $record->{email}    = $self->_trim($self->param('email'));
        $record->{password} = $self->_encrypt_password($self->param('password'));
        $record->{admin}    = $self->param('admin') ? 1 : 0;

lib/Mojolicious/Command/generate/bootstrap_app.pm  view on Meta::CPAN

    $string =~ s/^\s*(.*)\s*$/$1/gmx if defined $string;

    return $string
}

sub _validate_form {
    my $self = shift;

    if ($self->_trim($self->param('login')) !~ /[a-zA-Z]{3,10}/){
        $self->flash(class => 'alert alert-danger', message => $self->param('login') . ' does not match /[a-zA-Z]{3,10}/');
        return 0;

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

Mojolicious-Plugin-ACME-Command-acme-automate

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/ACME/Command/acme/automate.pm  view on Meta::CPAN

    sub { $acme->check_all_challenges(shift->begin) },
    sub {
      my ($delay, $err) = @_;
      die Mojo::Util::dumper($err) if $err;
      my $bad = c(values %{ $acme->challenges })->grep(sub { $_->{status} ne 'valid' });
      die 'The following challenges were not validated ' . Mojo::Util::dumper($bad->to_array) if $bad->size;
      #TODO poll for cert when delayed
      $cert = $acme->get_cert(@args);
    },
  )->catch(sub{ warn "$_[-1]\n" })->wait;

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

Mojolicious-Plugin-Angular-MaterialDesign

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/Angular/MaterialDesign/js/angular-material.min.js  view on Meta::CPAN

 * https://github.com/angular/material
 * @license MIT
 * v1.1.0
 */
!function(e,t,n){"use strict";!function(){t.module("ngMaterial",["ng","ngAnimate","ngAria","material.core","material.core.gestures","material.core.layout","material.core.theming.palette","material.core.theming","material.core.animate","material.compo...
t.forEach(p,function(n){t.forEach(h,function(t){var o=n?t+"-"+n:t;e.directive(d(o),r(o))}),t.forEach(f,function(t){var o=n?t+"-"+n:t;e.directive(d(o),a(o))})}),e.provider("$$mdLayout",function(){return{$get:t.noop,validateAttributeValue:l,validateAtt...
Math.max(o-E,0)>=g&&i>=b&&t()},o.on(A,w),$(o,d),m(t,g+1.5*v,!1)}),u}}}function h(e,t){t.addClass&&(l.addClass(e,t.addClass),t.addClass=null),t.removeClass&&(l.removeClass(e,t.removeClass),t.removeClass=null)}function f(e){function n(e){return o?"Webk...
}return{restrict:"E",controller:n,scope:{mdOnLayout:"&"},link:a}}function n(e){this.layoutInvalidated=!1,this.tilesInvalidated=!1,this.$timeout_=e.nextTick,this.layoutDelegate=t.noop}function o(e){function n(t,n){var o,a,d,s,c,l;return s=e.time(funct...
this._$q.when(this);var t=this;return this._$q(function(n){var o=t._done(n,t),i=function(){t._$log.warn("MdPanel Animations failed. Showing panel without animating."),o()};e.animateOpen(t._panelEl).then(o,i)})},o.prototype._animateClose=function(){va...
return["$mdUtil","$window",function(n,o){return{restrict:"A",multiElement:!0,link:function(i,r,a){var d=i.$on("$md-resize-enable",function(){d();var s=r[0],c=s.nodeType===o.Node.ELEMENT_NODE?o.getComputedStyle(s):{};i.$watch(a[e],function(e){if(!!e==...
this.repeatListExpression=t.bind(this,this.repeatListExpression_),this.container.register(this)},r.prototype.cleanupBlocks_=function(){t.forEach(this.pooledBlocks,function(e){e.element.remove()})},r.prototype.readItemSize_=function(){if(!this.itemSiz...
return"md-chips>*["+e+"]"}).join(","),p=i(m)||u.remove,h=l||u["default"],f=i("md-chips>md-autocomplete")||i("md-chips>input")||u.input,g=r.find("md-chip");return r[0].querySelector("md-chip-template>*[md-chip-remove]")&&d.warn("invalid placement of m...
},function(e){e&&(l.updateErrorState(),f())})}}}function o(e,n,o,i,r,a,d,s,c,l,m){this.$window=i,this.dateLocale=s,this.dateUtil=c,this.$mdConstant=r,this.$mdUtil=d,this.$$rAF=l,this.documentElement=t.element(document.documentElement),this.ngModelCtr...
}return i.$modelValue}function n(e){e?c.off("click",l):c.on("click",l)}var o=this,i=this.ngModel,r=this.$scope,a=this.$attrs,d=(this.$element,this.mode);this.handleClick=t.bind(this,this.handleClick);var s=this.iconEl,c=t.element(this.buttonEl),l=thi...
}()}(window,window.angular),window.ngMaterial={version:{full:"1.1.0"}};

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

Mojolicious-Plugin-Args

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/Args.pm  view on Meta::CPAN

                $args{__args}->{ $_ } = $args{ $_ }   for @args; # save to __priv
                $args{__json}->{ $_ } = $json->{ $_ } for @json; # for specific access
            } if $want_detail;
            $args{ $_ } = $json->{ $_ } for @json;
        }
        %args = ( %args, %save ); # this allows interception and override from route conditions that want to validate/modify and/or hooks
        $stash->{args} = \%args;
        return wantarray ? %{ $stash->{args} } : $stash->{args};
    } ) unless $app->renderer->helpers->{args};
}

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

Mojolicious-Plugin-Authentication

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/Authentication.pm  view on Meta::CPAN

sub register {
    my ($self, $app, $args) = @_;

    $args = { %{ $args || {} } }; # copy as mutating

    for my $cb_name (qw(load_user validate_user)) {
        my $p_name = $cb_name."_p";
        die __PACKAGE__, ": missing '$cb_name' subroutine ref in parameters\n"
            unless grep ref eq 'CODE', @$args{$cb_name, $p_name};
        $args->{$p_name} = sub {
            my @r = eval { $args->{$cb_name}->(@_) };

lib/Mojolicious/Plugin/Authentication.pm  view on Meta::CPAN

    my $autoload_user     = $args->{autoload_user}   // 0;
    my $session_key       = $args->{session_key}     || 'auth_data';
    my $our_stash_key     = $args->{stash_key}       || '__authentication__';
    my $current_user_fn   = $args->{current_user_fn} || 'current_user';
    my $load_user_cb      = $args->{load_user};
    my $validate_user_cb  = $args->{validate_user};
    my $load_user_cb_p    = $args->{load_user_p};
    my $validate_user_cb_p= $args->{validate_user_p};

    my $fail_render = ref $args->{fail_render} eq 'CODE'
       ? $args->{fail_render} : sub { $args->{fail_render} };

    my $user_loader_sub = user_loader_closure(

lib/Mojolicious/Plugin/Authentication.pm  view on Meta::CPAN

    my $current_user_p = user_stash_extractor_closure_p(
        $our_stash_key, $user_loader_sub_p,
    );

    $app->helper(authenticate => authenticate_closure(
        $our_stash_key, $session_key, $validate_user_cb, $current_user,
    ));
    $app->helper(authenticate_p => authenticate_closure_p(
        $our_stash_key, $session_key, $validate_user_cb_p, $current_user_p,
    ));

    $app->hook(before_dispatch => $user_loader_sub_p) if $autoload_user;

    $app->routes->add_condition(authenticated => sub {

lib/Mojolicious/Plugin/Authentication.pm  view on Meta::CPAN

        });
    };
}

sub authenticate_closure {
    my ($our_stash_key, $session_key, $validate_user_cb, $current_user) = @_;
    sub {
        my ($c, $user, $pass, $extradata) = @_;
        # if extradata contains "auto_validate", assume the passed username
        # is in fact valid, and auto_validate contains the uid; used for
        # OAuth and other stuff that does not work with usernames and
        # passwords; use this with extreme care if you must
        $extradata ||= {};
        my $uid = $extradata->{auto_validate} //
            $validate_user_cb->($c, $user, $pass, $extradata);
        return undef if !defined $uid;
        $c->session($session_key => $uid);
        # Clear stash to force reload of any already loaded user object
        delete $c->stash->{$our_stash_key};
        return 1 if defined $current_user->($c);
        return undef;
    };
}
sub authenticate_closure_p {
    my ($our_stash_key, $session_key, $validate_user_cb_p, $current_user_p) = @_;
    sub {
        my ($c, $user, $pass, $extradata) = @_;
        $extradata ||= {};
        my $promise = defined($extradata->{auto_validate})
            ? Mojo::Promise->resolve($extradata->{auto_validate})
            : $validate_user_cb_p->($c, $user, $pass, $extradata);
        $promise->then(sub {
            my ($uid) = @_;
            return undef if !defined $uid;
            $c->session($session_key => $uid);
            # Clear stash to force reload of any already loaded user object

lib/Mojolicious/Plugin/Authentication.pm  view on Meta::CPAN


    $self->plugin('Authentication' => {
        autoload_user   => 1,
        session_key     => 'wickedapp',
        load_user_p     => sub { ... },
        validate_user_p => sub { ... },
    });
    # ...
    $self->authenticate_p(
        'username', 'password',
        { optional => 'extra data stuff' },

lib/Mojolicious/Plugin/Authentication.pm  view on Meta::CPAN

    # or, synchronous style
    $self->plugin('Authentication' => {
        autoload_user   => 1,
        session_key     => 'wickedapp',
        load_user       => sub { ... },
        validate_user   => sub { ... },
        current_user_fn => 'user', # compatibility with old code
    });
    my $authenticated = $self->authenticate(
        'username', 'password',
        { optional => 'extra data stuff' },

lib/Mojolicious/Plugin/Authentication.pm  view on Meta::CPAN

any trouble, but be aware that if you define methods with the same names as
those below, you'll likely run into unexpected results.

=head2 authenticate($username, $password, $extra_data_hashref)

Authenticate will use the supplied C<load_user> and C<validate_user>
subroutine refs to see whether a user exists with the given username and
password, and will set up the session accordingly. Returns true when the user
has been successfully authenticated, false otherwise. You can pass additional
data along in the C<extra_data> hashref, it will be passed to your
C<validate_user> subroutine as-is. If the extra data hash contains a key
C<auto_validate>, the value of that key will be used as the UID, and
authenticate will not call your C<validate_user> callback; this can be used
when working with OAuth tokens or other authentication mechanisms that do not
use a local username and password form.

=head2 authenticate_p($username, $password, $extra_data_hashref)

lib/Mojolicious/Plugin/Authentication.pm  view on Meta::CPAN


=item load_user (REQUIRED)

A coderef for user loading (see L</"USER LOADING">)

=item validate_user (REQUIRED)

A coderef for user validation (see L</"USER VALIDATION">)

=item session_key (optional)

lib/Mojolicious/Plugin/Authentication.pm  view on Meta::CPAN

        my ($app, $uid) = @_;
        ...
        return $user;
    }

The uid is the value that was originally returned from the C<validate_user>
coderef. You must return either a user object (it can be a hashref, arrayref,
or a blessed object) or undef.

=head1 USER VALIDATION

User validation is what happens when we need to authenticate someone. The
coderef you pass to the C<validate_user> configuration key has the following
signature:

    sub {
        my ($c, $username, $password, $extradata) = @_;
        ...

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

Mojolicious-Plugin-AutoReload

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/AutoReload.pm  view on Meta::CPAN

                || $c->req->is_handshake;
            # Prevent Mojolicious from doing anything else with this
            # request.
            $c->stash( 'mojo.finished', 1 );
            $c->render_later;
            # Client is just looking for a response, but validate their
            # nonce first.
            if ( !$c->param( 'nonce' ) || $c->param( 'nonce' ) ne $nonce ) {
                return $c->rendered( 205 );
            }
            return $c->rendered( 204 );

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

Mojolicious-Plugin-Bcrypt

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/Bcrypt.pm  view on Meta::CPAN

            return bcrypt( $password, $settings );
        }
    );

    $app->helper(
        bcrypt_validate => sub {
            my $c = shift;
            my ( $plain, $crypted ) = @_;
            return $c->bcrypt( $plain, $crypted ) eq $crypted;
        }
    );

lib/Mojolicious/Plugin/Bcrypt.pm  view on Meta::CPAN

        my $self = shift;
        my $crypted_pass = $self->bcrypt( $self->param('password') );
        ...
    }

=head2 bcrypt_validate

Validates a password against a crypted copy (for example from your database).

    sub login {
        my $self = shift;
        my $entered_pass = $self->param('password');
        my $crypted_pass = $self->get_password_from_db();
        if ( $self->bcrypt_validate( $entered_pass, $crypted_pass ) ) {

            # Authenticated
            ...;
        }
        else {

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

Mojolicious-Plugin-BcryptSecure

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/BcryptSecure.pm  view on Meta::CPAN

            $_[1],
            $_[2] // $settings_without_salt . '$' . Crypt::Eksblowfish::Bcrypt::en_base64(Crypt::URandom::urandom(16)),
        );
    });

    $app->helper(bcrypt_validate => sub {
        return Mojo::Util::secure_compare Crypt::Eksblowfish::Bcrypt::bcrypt($_[1], $_[2]), $_[2];
    });
}

1;

lib/Mojolicious/Plugin/BcryptSecure.pm  view on Meta::CPAN


=encoding utf-8

=head1 NAME

Mojolicious::Plugin::BcryptSecure - Securely bcrypt and validate your passwords.

=head1 STATUS

=for html <a href="https://travis-ci.org/srchulo/Mojolicious-Plugin-BcryptSecure"><img src="https://travis-ci.org/srchulo/Mojolicious-Plugin-BcryptSecure.svg?branch=master"></a>

lib/Mojolicious/Plugin/BcryptSecure.pm  view on Meta::CPAN


L<Crypt::URandom> is used to generate the salt used in L</bcrypt> with strongest available source of non-blocking randomness on the current platform.

=item

L<Mojo::Util/secure_compare> is used in L</bcrypt_validate> when comparing the crypted passwords to
help prevent timing attacks.

=back

You also may want to look at L<Mojolicious::Command::bcrypt> to help easily generate crypted passwords

lib/Mojolicious/Plugin/BcryptSecure.pm  view on Meta::CPAN

  # optionally pass your own settings
  my $crypted_password = $c->bcrypt($plaintext_password, $settings);

C<$settings> is an optional string which encodes the algorithm parameters, as described in L<Crypt::Eksblowfish::Bcrypt>.

=head2 bcrypt_validate

Validates a password against a crypted password (from your database, for example):

  if ($c->bcrypt_validate($plaintext_password, $crypted_password)) {
      # Authenticated
  } else {
      # Uh oh...
  }

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

Mojolicious-Plugin-CSRFDefender

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/CSRFDefender.pm  view on Meta::CPAN

    }

    # input check
    $app->hook(before_dispatch => sub {
        my ($c) = @_;
        unless ($self->_validate_csrf($c)) {
            my $content;
            if ($self->error_template) {
                my $file = file($self->error_template);
                $content = $file->slurp;
            }

lib/Mojolicious/Plugin/CSRFDefender.pm  view on Meta::CPAN

    });

    return $self;
}

sub _validate_csrf {
    my ($self, $c) = @_;

    my $p_name = $self->parameter_name;
    my $s_name = $self->session_key;
    my $request_token = $c->req->param($p_name);

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

Mojolicious-Plugin-CanonicalURL

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/CanonicalURL.pm  view on Meta::CPAN

        $should_not_canonicalize_request_config,
        $inline_code,
        $end_with_slash,
        $canonicalize_before_render,
        %captures
    ) = _parse_and_validate_config($config);

    my $sub_string = '';
    my ($path_declared, $path_with_no_slashes_at_the_end_declared);
    if (defined $should_canonicalize_request_config) {
        ($path_declared, $path_with_no_slashes_at_the_end_declared, $sub_string) = _create_should_canonicalize_request_sub_string(

lib/Mojolicious/Plugin/CanonicalURL.pm  view on Meta::CPAN

sub _quote_sub {
    my ($sub_string, $captures) = @_;
    return Sub::Quote::quote_sub $sub_string, $captures, {no_install => 1, no_defer => 1};
}

sub _parse_and_validate_config {
    my ($config) = @_;

    my (
        $should_canonicalize_request,
        $should_not_canonicalize_request,

lib/Mojolicious/Plugin/CanonicalURL.pm  view on Meta::CPAN


        if (%$config) {
            my $captures_allowed;
            if (exists $config->{should_canonicalize_request}) {
                ($should_canonicalize_request, $captures_allowed) =
                  _validate_should_canonicalize_request_config(delete $config->{should_canonicalize_request}, 1);
            }
            if (exists $config->{should_not_canonicalize_request}) {
                ($should_not_canonicalize_request, $captures_allowed) = _validate_should_canonicalize_request_config(
                    delete $config->{should_not_canonicalize_request},
                    undef,
                );
            }

lib/Mojolicious/Plugin/CanonicalURL.pm  view on Meta::CPAN

        $canonicalize_before_render,
        %captures
    );
}

sub _validate_should_canonicalize_request_config {
    my ($config, $should_canonicalize_request) = @_;

    my $captures_allowed;
    my $config_name    = _get_should_canonicalize_request_config_name($should_canonicalize_request);
    my $config_reftype = Scalar::Util::reftype $config || '';

lib/Mojolicious/Plugin/CanonicalURL.pm  view on Meta::CPAN

            if (defined $reftype and $reftype eq 'SCALAR') {
                $captures_allowed = 1;
            }

            if (defined $reftype and $reftype eq 'HASH') {
                _validate_starts_with_hash($config_name, $_);
            }
        }
    } elsif (defined $config_reftype and $config_reftype eq 'HASH') {
        _validate_starts_with_hash($config_name, $config);
    }

    return ($config, $captures_allowed);
}

sub _validate_starts_with_hash {
    my ($config_name, $hash) = @_;
    my %copy = %$hash;
    Carp::confess "must provide key 'starts_with' to hash in $config_name" unless exists $copy{starts_with};
    Carp::confess 'value for starts_with must not be undef' unless defined $copy{starts_with};
    Carp::confess 'value for starts_with must be a scalar'

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

Mojolicious-Plugin-Captcha-reCAPTCHA

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/Captcha/reCAPTCHA.pm  view on Meta::CPAN

				$self->recaptcha->get_html( $self->app->recaptcha_public_key, $err, $use_ssl, $options )
			);
        }
    );
    $app->helper(
        validate_recaptcha => sub {
            my ( $self, $params ) = @_;

            my $result = $self->recaptcha->check_answer( $self->app->recaptcha_private_key,
                                                         $self->tx->remote_address,
                                                         $params->{recaptcha_challenge_field},

lib/Mojolicious/Plugin/Captcha/reCAPTCHA.pm  view on Meta::CPAN

This helper works like C<use_recaptcha> but returns the HTML instead of setting a stash
value. Also accepts the same params as C<use_recaptcha()>.

Intended to be used in templates.

=head2 validate_recaptcha

Handles the validation of the recaptcha. If an error occurs, the stash variable
"recaptcha_error" is set.

  $self->validate_recaptcha( $params );

C<$params> is a hashref with parameters of the HTTP request.
Returns "true" (1) if validation was successful and "false" (0) otherwise.

=head1 AUTHORS

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

Mojolicious-Plugin-Captcha

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/Captcha.pm  view on Meta::CPAN

			return $image_data;
		}
	);

	$app->helper(
		validate_captcha => sub {
			my ( $self, $string, $case_sens ) = @_;
			return $case_sens
				? $string eq &{$captcha_string}
				: uc($string) eq uc(&{$captcha_string})
			;

lib/Mojolicious/Plugin/Captcha.pm  view on Meta::CPAN


1;

=head1 NAME

Mojolicious::Plugin::Captcha - create and validate captcha for Mojolicious framework

=head1 VERSION

0.02

lib/Mojolicious/Plugin/Captcha.pm  view on Meta::CPAN

		$self->render( data => $self->create_captcha );
	}

	sub some_post : Local {
		my ($self, $c) = @_;
		if ($self->validate_captcha($c->req->param('captcha')){
		..
		} else {
		..
		}
	}

=head1 DESCRIPTION

This plugin create and validate Captcha, using L<GD::SecurityImage>

=head1 METHODS

=head2 create_captcha

Create Captcha image and output it.

=head2 validate_captcha

Validate captcha string

	Accept optional second parameter to switch comparator case sensitivity (default is off, i.e. comparator make case insensivity comparing)

	# case sensitivity comparing
	$self->validate_captcha($self->param('captcha'), 1);

=head1 CONFIGURATION

=over 4

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

Mojolicious-Plugin-CascadingConfig

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

t/basic.t
t/config_override.t
t/lib/MojoliciousTest.pm
t/modes_passed_in.t
t/modes_passed_in_required.t
t/modes_validate.t
t/myapp.conf
t/myapp.dev.conf
t/myapp.development.conf
t/myapp.prod.conf
t/myapp.stage.conf

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

Mojolicious-Plugin-ClientIP-Pluggable

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/ClientIP/Pluggable.pm  view on Meta::CPAN

=head1 METHODS

=head2 client_ip

Find a client IP address from the specified headers, with optional fallbacks. The address is
validated that it is publicly available (aka routable) IP address. Empty string is returned
if no valid address can be found.

=head1 OPTIONS

=head2 analyzed_headers

lib/Mojolicious/Plugin/ClientIP/Pluggable.pm  view on Meta::CPAN

            next unless $f;
            my @pairs = map { split $comma_re, $_ } split ';', $f;
            my @ips = map {
                my $ipv4_mask = qr/\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}/;
                # it is not completely valid ipv6 mask, but enough
                # to extract address. It will be validated later
                my $ipv6_mask = qr/[\w:]+/;
                if (/for=($ipv4_mask)|(?:"?\[($ipv6_mask)\].*"?)/i) {
                    ($1 // $2);
                } else {
                    ();

lib/Mojolicious/Plugin/ClientIP/Pluggable.pm  view on Meta::CPAN

                next unless $address_family;

                # possibly limit to acceptable address family
                next if $restrict_family && $restrict_family ne $address_family;

                # validate by family
                my $validator = $validator_for{$address_family};
                next unless $validator->($ip);

                # address seems valid, return its textual representation
                return $ip;

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

Mojolicious-Plugin-CountryDropDown

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN

    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

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

Mojolicious-Plugin-DBViewer

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/DBViewer/MySQL.pm  view on Meta::CPAN

  my $rule = [
    database => {default => ''} => [
      'safety_name'
    ] 
  ];
  my $vresult = $plugin->validator->validate($params, $rule);
  my $database = $vresult->data->{database};
  my $tables = $command->show_tables($database);
  
  return $self->render(
    database => $database,

lib/Mojolicious/Plugin/DBViewer/MySQL.pm  view on Meta::CPAN

    ],
    table => {default => ''} => [
      'safety_name'
    ]
  ];
  my $vresult = $plugin->validator->validate($params, $rule);
  my $database = $vresult->data->{database};
  my $table = $vresult->data->{table};
  
  my $table_def = $command->show_create_table($database, $table);

lib/Mojolicious/Plugin/DBViewer/MySQL.pm  view on Meta::CPAN

  my $rule = [
    database => {default => ''} => [
      'safety_name'
    ]
  ];
  my $vresult = $plugin->validator->validate($params, $rule);
  my $database = $vresult->data->{database};
  my $tables = $command->show_tables($database);
  
  # Get create tables
  my $create_tables = {};

lib/Mojolicious/Plugin/DBViewer/MySQL.pm  view on Meta::CPAN

  my $rule = [
    database => {default => ''} => [
      'safety_name'
    ]
  ];
  my $vresult = $plugin->validator->validate($params, $rule);
  my $database = $vresult->data->{database};
  my $tables = $command->show_tables($database);
  
  $self->render(
    database => $database,

lib/Mojolicious/Plugin/DBViewer/MySQL.pm  view on Meta::CPAN

  my $rule = [
    database => {default => ''} => [
      'safety_name'
    ],
  ];
  my $vresult = $plugin->validator->validate($params, $rule);
  my $database = $vresult->data->{database};
  
  # Get primary keys
  my $primary_keys = $command->show_primary_keys($database);
  

lib/Mojolicious/Plugin/DBViewer/MySQL.pm  view on Meta::CPAN

  my $rule = [
    database => {default => ''} => [
      'safety_name'
    ],
  ];
  my $vresult = $plugin->validator->validate($params, $rule);
  my $database = $vresult->data->{database};
  
  # Get null allowed columns
  my $null_allowed_columns = $command->show_null_allowed_columns($database);
  

lib/Mojolicious/Plugin/DBViewer/MySQL.pm  view on Meta::CPAN

    ],
    v1 => [
      'not_blank'
    ]
  ];
  my $vresult = $plugin->validator->validate($params, $rule);
  my $database = $vresult->data->{database};
  my $table = $vresult->data->{table};
  
  # Where
  my $column = $vresult->data->{c1};

lib/Mojolicious/Plugin/DBViewer/MySQL.pm  view on Meta::CPAN

  my $rule = [
    database => {default => ''} => [
      'safety_name'
    ],
  ];
  my $vresult = $plugin->validator->validate($params, $rule);
  my $database = $vresult->data->{database};
  
  # Get primary keys
  my $database_engines = $command->show_database_engines($database);
  

lib/Mojolicious/Plugin/DBViewer/MySQL.pm  view on Meta::CPAN

  my $rule = [
    database => {default => ''} => [
      'safety_name'
    ],
  ];
  my $vresult = $plugin->validator->validate($params, $rule);
  my $database = $vresult->data->{database};
  
  # Get primary keys
  my $charsets = $command->show_charsets($database);
  

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

Mojolicious-Plugin-Data-Validate-WithYAML

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/Data/Validate/WithYAML.pm  view on Meta::CPAN

package Mojolicious::Plugin::Data::Validate::WithYAML;

# ABSTRACT: validate form input with Data::Validate::WithYAML

use strict;
use warnings;

use parent 'Mojolicious::Plugin';

lib/Mojolicious/Plugin/Data/Validate/WithYAML.pm  view on Meta::CPAN

    my ($self, $app, $config) = @_;

    $config->{conf_path} = $app->home if !$config->{conf_path};
    $config->{no_steps}  = 1          if !defined $config->{no_steps};

    $app->helper( 'validate' => sub {
        my ($c, $file, $step) = @_;

        my $validator = _validator( $file, $config );
        my %params    = %{ $c->req->params->to_hash };
        my @args      = $step ? $step : ();
        my %errors    = $validator->validate( @args, %params );

        my $prefix = exists $config->{error_prefix} ?
            $config->{error_prefix} :
            'ERROR_';

lib/Mojolicious/Plugin/Data/Validate/WithYAML.pm  view on Meta::CPAN


=encoding UTF-8

=head1 NAME

Mojolicious::Plugin::Data::Validate::WithYAML - validate form input with Data::Validate::WithYAML

=head1 VERSION

version 0.06

lib/Mojolicious/Plugin/Data/Validate/WithYAML.pm  view on Meta::CPAN

  sub register {
      my $self = shift;

      # might be (age => 'You are too young', name => 'name is required')
      # or with error_prefix (ERROR_age => 'You are too young', ERROR_name => 'name is required')
      my %errors = $self->validate( 'registration' );
  
      if ( %errors ) {
         $self->stash( %errors );
         $self->render;
         return; 

lib/Mojolicious/Plugin/Data/Validate/WithYAML.pm  view on Meta::CPAN

    type: optional
    plugin: URL

=head1 HELPERS

=head2 validate

    my %errors = $controller->validate( $yaml_name );

Validates the parameters. Optional parameter is I<$yaml_name>. If I<$yaml_name> is ommitted, the subroutine name (e.g. "register") is used.

=head1 AUTHOR

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

Mojolicious-Plugin-FeedReader

 view release on metacpan or  search on metacpan

t/samples/perlmonks.html  view on Meta::CPAN

any other options ?
</i>
<br />

<br />
Do we have some perl code checker available for us to validate scripts / modules ?
<br />Thanks

<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-1052035">
<i>Do not wait to strike when the iron is hot! Make it hot by striking - WB Yeats</i>

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

Mojolicious-Plugin-Fondation-Auth-Token

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/Fondation/Auth/Token.pm  view on Meta::CPAN

    };
}

sub register ($self, $app, $config) {

    # ── around_dispatch: validate Bearer, set current_user, flag stash ──

    $app->hook(around_dispatch => sub ($next, $c) {
        my $token = _extract_bearer($c) or return $next->();

        my $hash = sha256_hex($token);

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

Mojolicious-Plugin-Fondation-Auth

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/Fondation/Auth.pm  view on Meta::CPAN

                {
                    key         => 'provider',
                    label       => 'Auth Provider Class',
                    type        => 'string',
                    default     => 'Mojolicious::Plugin::Fondation::Auth::Provider::DBIx',
                    placeholder => 'Perl class implementing validate_user, load_user, auth_form',
                },
                {
                    key         => 'username_column',
                    label       => 'Username Column',
                    type        => 'string',

lib/Mojolicious/Plugin/Fondation/Auth.pm  view on Meta::CPAN

    $app->plugin('Authentication' => {
        session_key   => $config->{session_key},
        load_user     => sub ($app, $uid) {
            return $provider->load_user($app, $uid);
        },
        validate_user => sub ($c, $username, $password, $extra = {}) {
            return $provider->validate_user($c, $username, $password, $extra);
        },
    });

    # ── Helpers ──────────────────────────────────────────────────────
    $app->helper(auth_form => sub ($c) {

lib/Mojolicious/Plugin/Fondation/Auth.pm  view on Meta::CPAN


=item provider

Provider class for authentication (default:
C<Mojolicious::Plugin::Fondation::Auth::Provider::DBIx>).
Must implement C<validate_user>, C<load_user>, and C<auth_form>.

    { 'Fondation::Auth' => { provider => 'MyApp::Auth::Provider::LDAP' } }

=item username_column

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

Mojolicious-Plugin-Fondation-CSRF

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/Fondation/CSRF.pm  view on Meta::CPAN


        # Bearer token auth bypasses CSRF — no session cookie, no CSRF risk
        my $auth = $c->req->headers->authorization;
        return 1 if $auth && $auth =~ /^Bearer\s+/i;

        # Delegate to Mojo's built-in csrf_protect (validates csrf_token
        # from form field or X-CSRF-Token header against session token)
        $c->validation->csrf_protect;

        unless ($c->validation->has_error('csrf_token')) {
            return 1;

lib/Mojolicious/Plugin/Fondation/CSRF.pm  view on Meta::CPAN


=head1 DESCRIPTION

C<Mojolicious::Plugin::Fondation::CSRF> provides Cross-Site Request Forgery
protection for Fondation applications. It uses Mojolicious' built-in CSRF
token mechanism (stored in session, validated via L<Validation/csrf_protect>).

Three protection layers, all using the same underlying Mojo validation:

=over 4

lib/Mojolicious/Plugin/Fondation/CSRF.pm  view on Meta::CPAN

C<requires('fondation.csrf')> via the C<openapi_routes_added> hook.

=item 5. HTML POST routes are protected by C<around_dispatch> when
C<auto_protect> is enabled (default), or by explicit C<requires('fondation.csrf')>.

=item 6. Mojo's C<csrf_protect> validates the token from form field or
C<X-CSRF-Token> header against the session token.

=back

=head1 HOW TOKEN VALIDATION WORKS

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

Mojolicious-Plugin-Fondation-Group-UI-Bootstrap

 view release on metacpan or  search on metacpan

share/public/js/DatatableGroup.js  view on Meta::CPAN

    });

    // ────────────────────────────────────────────────
    // Form validation using validators.js
    // ────────────────────────────────────────────────
    async function validateGroupForm() {
        const form = document.getElementById('group-form');
        if (!form) {
            console.error("Form #group-form not found");
            return { valid: false, errors: [{ field: null, message: l("Form not found") }], data: {} };
        }

share/public/js/DatatableGroup.js  view on Meta::CPAN

                formDataObj[key] = formDataObj[key].trim();
            }
        });

        // Validate via FondationValidators
        if (typeof window.FondationValidators === 'undefined' || typeof FondationValidators.validate !== 'function') {
            console.error("FondationValidators not loaded or invalid");
            return { valid: false, errors: [{ field: null, message: l("Validator not available") }], data: {} };
        }

        const schemaName = 'Group';

        const result = FondationValidators.validate(schemaName, formDataObj);

        // Collect perm assignments (provided by Fondation::Perm::UI::Bootstrap)
        if (typeof collectPermAssignments === 'function') {
            formDataObj.perms = collectPermAssignments();
        }

share/public/js/DatatableGroup.js  view on Meta::CPAN

    $('#saveObject').on('click', async function() {
        const button = $(this);
        button.prop('disabled', true).html('<i class="fa fa-spinner fa-spin"></i> ' + l("Saving..."));

        try {
            const validation = await validateGroupForm();
            if (!validation.valid) {
                displayValidationErrors(validation.errors);
                return;
            }

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

Mojolicious-Plugin-Fondation-Layout-Bootstrap

 view release on metacpan or  search on metacpan

share/public/css/bootstrap-select.min.css  view on Meta::CPAN

/*!
 * Bootstrap-select v1.14.0-beta2 (https://developer.snapappointments.com/bootstrap-select)
 *
 * Copyright 2012-2021 SnapAppointments, LLC
 * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE)
 */@-webkit-keyframes bs-notify-fadeOut{0%{opacity:.9}100%{opacity:0}}@-o-keyframes bs-notify-fadeOut{0%{opacity:.9}100%{opacity:0}}@keyframes bs-notify-fadeOut{0%{opacity:.9}100%{opacity:0}}.bootstrap-select>select.bs-select-hidden,select.bs-select-...

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

Mojolicious-Plugin-Fondation-Menu

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/Fondation/Menu/Controller/Menu.pm  view on Meta::CPAN

    $self->model('menu')->create($json)->on_done(sub {
        my $menu = shift;
        my $data = $menu->TO_JSON;
        $self->res->headers->location($self->url_for('read_menu', id => $data->{id}));
        $self->render(status => 201, openapi => $data);
        $self->menu_cache_invalidate if $self->has_helper('menu_cache_invalidate');
    })->on_fail(sub ($err) { $self->problem(status => 500, detail => "$err") })->retain;
}

sub read ($self) {
    $self = $self->openapi->valid_input or return;

lib/Mojolicious/Plugin/Fondation/Menu/Controller/Menu.pm  view on Meta::CPAN

        }
        $menu->update($json)->on_done(sub {
            my $updated = shift;
            my $data    = $updated->TO_JSON;
            $self->render(openapi => $data);
            $self->menu_cache_invalidate if $self->has_helper('menu_cache_invalidate');
        })->on_fail(sub ($err) { $self->problem(status => 500, detail => "$err") })->retain;
    })->on_fail(sub ($err) { $self->problem(status => 500, detail => "$err") })->retain;
}

sub delete ($self) {

lib/Mojolicious/Plugin/Fondation/Menu/Controller/Menu.pm  view on Meta::CPAN

                { errors => [{ message => 'Not found', path => '/' }] });
            return;
        }
        $menu->delete->on_done(sub {
            $self->render(status => 204, openapi => {});
            $self->menu_cache_invalidate if $self->has_helper('menu_cache_invalidate');
        })->on_fail(sub ($err) { $self->problem(status => 500, detail => "$err") })->retain;
    })->on_fail(sub ($err) { $self->problem(status => 500, detail => "$err") })->retain;
}

1;

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

Mojolicious-Plugin-Fondation-Model-DBIx-Async

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/Fondation/Model/DBIx/Async.pm  view on Meta::CPAN

=head2 Model discovery

During C<fondation_finalyze>, the plugin scans every loaded Fondation plugin
for a C<models> key in their configuration. Models declared by dependency
plugins are merged, with the application configuration taking priority.
Each model is validated to have a resolvable backend.

=head2 Source registration

The C<DBIx> action (L<Mojolicious::Plugin::Fondation::Model::DBIx::Async::Action::DBIx>)
auto-discovers C<Result> and C<ResultSet> classes under each plugin's

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

Mojolicious-Plugin-Fondation-OpenAPI

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/Fondation/OpenAPI.pm  view on Meta::CPAN

  }

=head3 C<no_validator_js>

When set to C<1>, C<openapi generate> still writes C<public/js/validators.js>
but the generated C<validate()> function accepts everything
(C<return { valid: true, errors: [] }>). Server-side OpenAPI validation is
unaffected. Use it to rely solely on server validation (e.g. during testing).

Re-enable client validation by setting it back to C<0> (or removing the key)
and regenerating. The same setting is exposed as a boolean parameter in the

lib/Mojolicious/Plugin/Fondation/OpenAPI.pm  view on Meta::CPAN

projections (only when different), and CRUD paths. Committed to the
application repository.

=item C<public/js/validators.js>

Client-side form validation via C<FondationValidators.validate()>.
Consumed by L<Fondation::Asset> bundles. Committed to the application
repository.

=back

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

Mojolicious-Plugin-Fondation-Perm-UI-Bootstrap

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/Fondation/Perm/UI/Bootstrap.pm  view on Meta::CPAN

Fetches all permissions via C<GET /api/perm>, renders checkboxes, and pre-checks
those the group already has (from C<group.perms>).

=item C<collectPermAssignments()>

Returns an array of checked permission IDs — called by C<validateGroupForm()>
in C<DatatableGroup.js> before save.

=back

=back

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

Mojolicious-Plugin-Fondation-User-UI-Bootstrap

 view release on metacpan or  search on metacpan

share/public/js/DatatableUser.js  view on Meta::CPAN

    });

    // ────────────────────────────────────────────────
    // Form validation using validators.js
    // ────────────────────────────────────────────────
async function validateUserForm() {
    const form = document.getElementById('user-form');
    if (!form) {
        console.error("Form #user-form not found");
        return { valid: false, errors: [{ field: null, message: l("Form not found") }], data: {} };
    }

share/public/js/DatatableUser.js  view on Meta::CPAN

    });

    // IMPORTANT: DO NOT REMOVE password_confirm here, we need it for verification

    // Validate via FondationValidators
    if (typeof window.FondationValidators === 'undefined' || typeof FondationValidators.validate !== 'function') {
        console.error("FondationValidators not loaded or invalid");
        return { valid: false, errors: [{ field: null, message: l("Validator not available") }], data: {} };
    }

    // Determine schema based on mode

share/public/js/DatatableUser.js  view on Meta::CPAN


    // In create mode, remove id to avoid sending an empty string to the server
    if (!isUpdate) {
        delete formDataObj.id;
    }
    const result = FondationValidators.validate(schemaName, formDataObj);

    // Additional validation for password / confirm (only if password is filled)
    if (formDataObj.password) {
        const pw = formDataObj.password.trim();
        const confirm = (formDataObj.password_confirm || '').trim();

share/public/js/DatatableUser.js  view on Meta::CPAN

    $('#saveObject').on('click', async function() {
        const button = $(this);
        button.prop('disabled', true).html('<i class="fa fa-spinner fa-spin"></i> ' + l("Saving..."));

        try {
            const validation = await validateUserForm();
            if (!validation.valid) {
                displayValidationErrors(validation.errors);
                return;
            }

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

Mojolicious-Plugin-FormFields

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/FormFields.pm  view on Meta::CPAN

    if($eq) {
	$field->{$eq} = $self->{c}->param($eq);
	push @{$rules->{fields}}, $eq;
    }

    $result = Validate::Tiny::validate($field, $rules);
    $self->{c}->param($name, $result->{data}->{$name}) if @{$self->{filters}};
    $self->{result} = $result;

    $result->{success};
}

lib/Mojolicious/Plugin/FormFields.pm  view on Meta::CPAN

  <% } %>

=head1 VALIDATING & FILTERING

Validation rules are created by calling validation and/or filter methods
on the field to be validated

  # In your controller
  my $self = shift;
  $self->field('user.name')->is_required;
  $self->field('user.name')->filter('trim');

lib/Mojolicious/Plugin/FormFields.pm  view on Meta::CPAN

  $field = $self->field('user.name');
  $field->is_required;
  $field->valid;
  $field->error;

This will only validate and return the error for the C<user.name> field. To validate all fields and retrieve all error messages call the controller's C<valid> and C<errors> methods

  $self->field('user.name')->is_required;
  $self->field('user.age')->is_like(qr/^\d+$/);
  $self->valid;

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

Mojolicious-Plugin-FormFieldsFromJSON

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/FormFieldsFromJSON.pm  view on Meta::CPAN

            return @fields;
        }
    );

    $app->helper(
        'validate_form_fields' => sub {
            my ( $c, $file ) = @_;

            return '' if !$file;

            if ( !$configs{$file} ) {

lib/Mojolicious/Plugin/FormFieldsFromJSON.pm  view on Meta::CPAN

    ]
  );

This way, you can build your forms dynamically (e.g. based on database entries).

=head2 validate_form_fields

This helper validates the input. It uses the L<Mojolicious::Validator::Validation> and it
validates all fields defined in the configuration file.

For more details see L<Validation|Mojolicious::Plugin::FormFieldsFromJSON/Validation>.

=head2 forms

lib/Mojolicious/Plugin/FormFieldsFromJSON.pm  view on Meta::CPAN


=back

=head1 Validation

You can define some validation rules in your config file. And when you call C<validate_form_fields>, the
fields defined in the configuration file are validated.

L<Mojolicious::Validator::Validation> is shipped with some basic validation checks:

=over 4

lib/Mojolicious/Plugin/FormFieldsFromJSON.pm  view on Meta::CPAN

        },
        "name" : "name"
    }
 ]

Then you can call C<validate_form_fields>:

  my %errors = $c->validate_form_fields( $config_name );

In the returned hash, you get the fieldnames as keys where a validation check fails.

=head2 A mandatory string

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

( run in 1.222 second using v1.01-cache-2.11-cpan-ad19def0cd9 )