2017 © Pedro Peláez
 

library validate-laravel-sentry

Custom Laravel 4 Validator for Sentry Auth service provider composer package

image

hampel/validate-laravel-sentry

Custom Laravel 4 Validator for Sentry Auth service provider composer package

  • Tuesday, December 17, 2013
  • by hampel
  • Repository
  • 0 Watchers
  • 0 Stars
  • 10 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Hampel Laravel Sentry Validator

Custom Validators for Laravel 4 for Sentry Authentication, (*1)

By Simon Hampel., (*2)

Installation

The recommended way of installing Hampel Laravel Sentry Validator is through Composer:, (*3)

Require the package via Composer in your composer.json, (*4)

:::json
{
    "require": {
        "hampel/validate-laravel-sentry": "1.1.*"
    }
}

Run Composer to update the new requirement., (*5)

:::bash
$ composer update

The package is built to work with the Laravel 4 Framework., (*6)

Open your Laravel config file config/app.php and add the service provider in the $providers array:, (*7)

:::php
"providers" => array(

    ...

    "Hampel\Validate\LaravelSentry\ValidateServiceProvider"

),

Note that we assume you are already using Cartalyst Sentry and thus have the 'Cartalyst\Sentry\SentryServiceProvider' entry in the providers array already., (*8)

Usage

This package adds an additional validator for Laravel 4 - refer to Laravel Documentation - Validation for general usage instructions., (*9)

sentry:userid, (*10)

The field under validation must be a password, which is combined with the supplied userid value which is then passed to Sentry's User Provider findByCredentials routine to check whether this is a valid userid/password combination., (*11)

The parameter to the auth rule is required (if not provided, the rule will always fail), and should be set to the userid to include in the credentials., (*12)

Create a user credentials array (userid, password), using the database column names for the array keys and pass that to the validator. The array key of the userid can be accessed by the config setting 'cartalyst/sentry::users.login_attribute', (*13)

Example

:::php
$userid_field = Config::get('cartalyst/sentry::users.login_attribute');
$password_field = "password";

$userid = Input::get('email');
$password = Input::get('password');

$credentials = array(
    $userid_field => $userid,
    $password_field => $password
);

// Declare the rules for the form validation.
$rules = array(
    $userid_field => 'required',
    $password_field => array('required', 'sentry:' . $userid)
);

// Validate the inputs.
$validator = Validator::make($credentials, $rules);

// Check if the form validates with success.
if ($validator->passes())
{
    dd("passes");
}
else
{
    dd("fails");
}

The Versions

17/12 2013

dev-master

9999999-dev https://bitbucket.org/hampel/validate-laravel-sentry

Custom Laravel 4 Validator for Sentry Auth service provider composer package

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel authentication validation sentry

17/12 2013
13/12 2013

1.1.0

1.1.0.0 https://bitbucket.org/hampel/validate-laravel-sentry

Custom Laravel 4 Validator for Sentry Auth service provider composer package

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel authentication validation sentry

27/09 2013

1.0.1

1.0.1.0 https://bitbucket.org/hampel/validate-laravel-sentry

Custom Laravel 4 Validator for Sentry Auth service provider composer package

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel authentication validation sentry

27/09 2013

1.0.0

1.0.0.0 https://bitbucket.org/hampel/validate-laravel-sentry

Custom Laravel 4 Validator for Sentry Auth service provider composer package

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel authentication validation sentry