codepunk/activatinator
Composer 安装命令:
composer require codepunk/activatinator
包简介
Package for adding user activation on top of Laravel's 'Auth' framework
README 文档
README
Introduction
Codepunk Activatinator is an extension of Laravel's Auth framework that requires users to activate their account via email (or other notification) before being allowed to view any content normally visible to authenticated users.
Activatinator mimics the logic and extendability of the Laravel Auth "Password Reset" functionality. See Laravel's Authentication and Resetting Passwords pages for more information. Many of the customizations provided by Laravel when it comes to resetting passwords are also provided by the Activatinator.
What's with the name?
The over-syllabic "Activatinator" is a shout-out to Heinz Doofenshmirtz, the villain in the "Phineas and Ferb" cartoon series. According to the Phineas and Ferb Wiki, "Doofenshmirtz's schemes and inventions, primarily known as 'Inators,' are plans and devices created by Dr. Heinz Doofenshmirtz as a means of dominating and taking over the Tri-State Area or other locations."
Since coding can often times feel like hatching a brilliant (and sometimes evil) scheme to take over the world, Codepunk borrows Doofenshmirtz's "Inator"-style naming convention.
Install
-
If you haven't already done so:
-
Create a new Laravel project:
$ laravel new my_project
-
Update your
.envfile to point to a valid database and email client. -
From within your new project directory, set up the Laravel authentication framework:
$ php artisan make:auth
-
-
Require the Codepunk Activatinator!
-
Via Composer:
$ composer require codepunk/activatinator
-
Manually:
In the
requiresection of your project's `composer.json' file, add the following:"codepunk/activatinator": "^1.2.1"
(Or whatever the latest version happens to be)
Then, update your project by executing the following command:
$ composer update
-
-
Publish the Activatinator package:
$ php artisan vendor:publish --force
And choose the Codepunk ActivatinatorServiceProvider option.
-
Update the database with the required changes:
$ php artisan migrate:refresh
-
Make changes to your
App\Usermodel:-
Add the following
usestatements:use Codepunk\Activatinator\Activable; use Codepunk\Activatinator\Contracts\Activable as ActivableContract;
-
Update the following:
class User extends Authenticatable
to this:
class User extends Authenticatable implements ActivableContract
-
Update the following:
use Notifiable;
to this:
use Notifiable, Activable;
-
NOTE: If you are also using Laravel Passport to implement OAuth in your application, then we want the
oauth\tokenendpoint to fail when the user has not yet been authenticated. To implement this behavior, add theCodepunk\Activatinator\Traits\ValidatesForPassporttrait to yourApp\Usermodel (in addition to Passport'sHasApiTokenstrait as described in the Laravel Passport documentation):use Notifiable, Activable, HasApiTokens, ValidatesForPassport;
-
-
Make changes to
app/Http/Controllers/Auth/ForgotPasswordController.php:Update the following:
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
to this:
use Codepunk\Activatinator\SendsPasswordResetEmails;
-
Make changes to
app/Http/Controllers/Auth/LoginController.php:Update the following:
use Illuminate\Foundation\Auth\AuthenticatesUsers;
to this:
use Codepunk\Activatinator\AuthenticatesUsers;
-
Make changes to
app/Http/Controllers/Auth/RegisterController.php:Update the following:
use Illuminate\Foundation\Auth\RegistersUsers;
to this:
use Codepunk\Activatinator\RegistersUsers;
-
Make changes to
resources/views/auth/login.blade.php:Find these lines:
<div class="card-body"> <form method="POST" action="{{ route('login') }}">
And add the following line in between so it looks like this:
<div class="card-body"> @include('codepunk::activatinator-alerts') <form method="POST" action="{{ route('login') }}">
License
Codepunk Activatinator is open-sourced software licensed under the MIT license
codepunk/activatinator 适用场景与选型建议
codepunk/activatinator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 54 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 06 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「auth」 「laravel」 「verification」 「activation」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 codepunk/activatinator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codepunk/activatinator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 codepunk/activatinator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel Multiauth package
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
Laravel Package for easier user email verification.
This package provides a flexible way to add Role-based Permissions to Laravel 6.x
Email Toolkit Plugin for CakePHP
The TOTP based on [RFC6238](https://tools.ietf.org/html/rfc6238)
统计信息
- 总下载量: 54
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-06-11