yiicod/yii2-auth
最新稳定版本:1.0.2
Composer 安装命令:
composer require yiicod/yii2-auth
包简介
The simple auth(login,signup,forgot) with powerful extension for the Yii2 framework
README 文档
README
If you want simple auth (login/signup/forgot), this is what you want! This extension has simple action what have added in controller. Extension has events:
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist yiicod/yii2-auth "*"
or add
"yiicod/yii2-auth": "*"
to the require section of your composer.json.
run
php yii migrate/up --migrationPath=@yiicod/auth/migrations
Please note that messages are wrapped with Yii::t() to support message translations, you should define default message source for them if you don't use i18n.
'i18n' => [ 'translations' => [ '*' => [ 'class' => 'yii\i18n\PhpMessageSource' ], ], ],
Config
'components' => [ 'auth' => [ 'class' => 'yiicod\auth\Auth', ], ] 'bootstrap' => ['auth']
Using
Copy yiicod\auth\controllers\WebUserController to controllers folder. After this you can use actions
/** * Declares class-based actions. * For change functional use AuthUserBehavior. * Auth events: * * - beforeLogin(ActionEvent) * - afterLogin(ActionEvent) * - errorLogin(ActionEvent) * * - beforeSignup(ActionEvent) * - afterSignup(ActionEvent) * - errorSignup(ActionEvent) * * - beforeCheckRecoveryKey(ActionEvent) * - afterCheckRecoveryKey(ActionEvent) * - errorCheckRecoveryKey(ActionEvent) * * - beforeForgot(ActionEvent) * - afterForgot(ActionEvent) * - errorForgot(ActionEvent) * * - beforeLogout(ActionEvent) * - afterLogout(ActionEvent) * * * Global events * yiicod.auth.controllers.webUser.[Action class name].[Event name (beforeLogin)] * * */ public function actions() { return ArrayHelper::merge(parent::actions(), [ 'login' => [ 'class' => \yiicod\auth\actions\webUser\LoginAction::className(), ], 'requestPasswordReset' => [ 'class' => \yiicod\auth\actions\webUser\RequestPasswordResetAction::className(), ], 'logout' => [ 'class' => \yiicod\auth\actions\webUser\LogoutAction::className(), ], 'signup' => [ 'class' => \yiicod\auth\actions\webUser\SignupAction::className(), ], 'resetPassword' => [ 'class' => \yiicod\auth\actions\webUser\ResetPasswordAction::className(), ], ] ); }
统计信息
- 总下载量: 126
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: New
- 更新时间: 2015-05-29