enigmatix/yii2-confirmation 问题修复 & 功能扩展

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

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

enigmatix/yii2-confirmation

最新稳定版本:1.1.3

Composer 安装命令:

composer require enigmatix/yii2-confirmation

包简介

Allows the caching of a value and storing in a table to be approved at a later date

README 文档

README

Latest Stable Version Latest Unstable Version Build Status Scrutinizer Code Quality License

Confirmation Behavior

This behavior protects variable(s) in a model from being changed by sending a confirmation request via email. This is ideally used for secure information, such as email addresses connected to user accounts, where you want to ensure the user has access to the new email address before commiting the change.

Once a user attempts to change an email, the request and the object are stored, and the release token is sent either to the new email address, or if another attribute is changed, to the current email address of the user.

The functionality traverses the 'createdBy' link to the user's table. If no email is found in the model, and no email can be retrieved from the createdBy link, an exception will be thrown.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist enigmatix/yii2-confirmation "*"

or add

"enigmatix/yii2-confirmation": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed:

  1. Run the migration
./yii migrate --migrationPath=@vendor/enigmatix/yii2-confirmation/migration

  1. Add the behavior to the appropriate model.

Class User extends ActiveRecord {

...
    public function behaviors()
    {
        return [
        ...
            [
                'class'                 => ConfirmationBehavior::className(),
                'protectedAttributes'   => ['email'], //your attribute name here
              //'allow'                 => ['roleA', ['roleB']

            ],
        ];
    }
}

The 'allow' node is optional, and only required if you want certain roles to be excluded from generating a confirmation. Often useful for admin or other privileged users.

  1. Add the controller to your frontend or app config/main.php
return [
...
    'controllerMap' => [
        'confirmation-requests' => 'enigmatix\confirmation\ConfirmationRequestsController'
    ],
];

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固