cerbero/auth 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cerbero/auth

最新稳定版本:1.6.4

Composer 安装命令:

composer require cerbero/auth

包简介

Laravel module to implement the authentication system into your applications.

README 文档

README

Auth

Author Build Status Latest Version Software License Code Climate Quality Score Gratipay

SensioLabsInsight

Auth is a Laravel package to quickly implement the authentication system into your applications, avoiding you to reinvent the wheel every time you start a new project and letting you customize every single aspect of the process.

This package is intended to be a more customizable alternative to the authentication system shipped by Laravel out of the box and also includes some security features like honeypot and login throttling.

Features

List of features included in this package:

  • Login
  • Registration
  • Password reset
  • Logout
  • Full customization
  • CSRF protection
  • Honeypot trap
  • Login throttling
  • Event dispatching

Install

Run this command in your application root:

composer require cerbero/auth

Add the service provider to the providers list in config/app.php:

Cerbero\Auth\AuthServiceProvider::class,

Add the following route middleware in app/Http/Kernel.php:

'honeypot' => \Cerbero\Auth\Http\Middleware\Honeypot::class,

And then run these two commands in your terminal:

php artisan vendor:publish --provider="Cerbero\Auth\AuthServiceProvider”
php artisan migrate

Now you have the database migrated with the users table and can customize the behavior of the authentication system by editing the file config/_auth.php as well as modify/translate the messages in resources/lang/packages.

Finally, in order to display custom messages to the users, add the DisplaysExceptions trait to your exceptions handler:

use Cerbero\Auth\Exceptions\DisplaysExceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler {

	use DisplaysExceptions;

	public function render($request, Exception $e)
	{
		if($printable = $this->displayExceptions($e)) return $printable;

		return parent::render($request, $e);
	}

}

So now you can display the custom messages in your views:

@if ($error = session('error'))
	<div class="alert alert-danger">{{ $error }}</div>
@elseif ($success = session('success'))
	<div class="alert alert-success">{{ $success }}</div>
@endif

Events

All authentication processes are preceded and followed by events to provide an easy way to extend the package functionalities. The following list shows all the available events:

  • auth.login.start
  • auth.login.end
  • auth.logout.start
  • auth.logout.end
  • auth.register.start
  • auth.register.end
  • auth.recover.start
  • auth.recover.end
  • auth.reset.start
  • auth.reset.end

统计信息

  • 总下载量: 200
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 49
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 48
  • Watchers: 6
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-26