2017 © Pedro Peláez
 

library restricted

Restricts registration when a user's input (eg: username) matches a list of restricted words

image

tradzero/restricted

Restricts registration when a user's input (eg: username) matches a list of restricted words

  • Tuesday, February 27, 2018
  • by tradzero
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 8 Versions
  • 50 % Grown

The README.md

Restricted

Restricted allows you to restrict your users from signing up with reserved words., (*1)

Reserved words can be:, (*2)

  1. Your route segments - Example, you have this route: www.mywebsite.com/login and your application allows to view user profile like this: www.mywebsite.com/username This package can crawl all your routes and return a validation message when a user tries to register with such words like "login"
  2. Words you just want to reserve - Example: cart, products, admin etc. These words can be added manually to the reserved.txt file. after running the "restricted:index" command.

Installation

To install Restricted use composer, (*3)

Download

composer require codulab/restricted

Add service provider

Add the following service provider to the array in: config/app.php, (*4)

Codulab\Restricted\RestrictedServiceProvider::class,

Publish the config

php artisan vendor:publish --tag=restricted_config

Usage

First, we need to crawl and index the application routes by running the command:, (*5)

php artisan restricted:index

Now, you can simply add restricted to your validations like so:, (*6)

    $this->validate($request, [
        'name' => 'required|string|min:5',
        'username' => 'required|restricted'
    ]);

You can also add a new validation message, (*7)

    $this->validate($request, [
        'name' => 'required|string|min:5',
        'username' => 'required|restricted'
    ],[
        'username.restricted' => 'A user exists with that username. Please try another or add more characters'
    ]);

Settings

  • file_path: (string) File name and path to save the indexed words
  • index_level: (int) How deep do u want us to crawl your routes? ExAMPLE => www.mywebsite.com/segment1/segmen2/segment3. setting this value to '2', will allow indexing of segment1 and segment2 and exclude segment3
  • merge: (bool) should we to merge the new results with the old ones

License

MIT license - free to use and abuse!, (*8)

The Versions

27/02 2018

dev-master

9999999-dev

Restricts registration when a user's input (eg: username) matches a list of restricted words

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

by Avatar codulab

security username restricted

27/02 2018

v1.1

1.1.0.0

Restricts registration when a user's input (eg: username) matches a list of restricted words

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

by Avatar codulab

security username restricted

27/02 2018

V1.0.4

1.0.4.0

Restricts registration when a user's input (eg: username) matches a list of restricted words

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

by Avatar codulab

security username restricted

11/02 2018

dev-dev

dev-dev

Restricts registration when a user's input (eg: username) matches a list of restricted words

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

by Avatar codulab

security username restricted

22/08 2017

v1.0.3

1.0.3.0

Restricts registration when a user's input (eg: username) matches a list of restricted words

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

by Avatar codulab

security username restricted

04/12 2016

v1.0.2

1.0.2.0

Restricts registration when a user's input (eg: username) matches a configured restricted words

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

by Avatar codulab

security username restricted

04/12 2016

v1.0.1

1.0.1.0

Restricts registration when a user's input (eg: username) matches a configured restricted words

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

by Avatar codulab

security username restricted

03/12 2016

v1.0

1.0.0.0

Restricts registration when a user's input (eg: username) matches a configured restricted words

  Sources   Download

MIT

by Avatar codulab