定制 originphp/user_authentication 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

originphp/user_authentication

Composer 安装命令:

composer require originphp/user_authentication

包简介

User Authentication Plugin for OriginPHP

README 文档

README

The User Authentication plugin, provides user registration, sending a welcome emails, changing passwords, verifying user email addresses using email notifications. This plugin takes less than 2 minutes to add to your application and provides you with everything you need to get started.

Installation

Install the the UserAuthentication plugin

$ composer require originphp/user_authentication

Setup

Load the AuthComponent in the AppController initialize method.

class AppController extends Controller
{
    protected function initialize() : void
    {
        $this->loadComponent('Auth', [
            'loginAction' => '/login',
            'loginRedirect' => '/profile', # Set this to something valid
            'logoutRedirect' => '/login',
            'model' => 'UserAuthentication.User'
        ]);
    }
}

Load database schema for the User (you can change this later)

$ bin/console db:schema:load UserAuthentication.schema

Load the Queue schema, which use for sending reset password and email verification notices.

$ bin/console db:schema:load queue

Set the App.name value in your config/application.php

Config::write('App.name','Web Application');

Usage

To signup

http://localhost:8000/signup

To login

http://localhost:8000/login

This will take you to the loginRedirect setting you setup in your AppController

To start the password reset process

http://localhost:8000/forgot_password

To view or edit your user profile

http://localhost:8000/profile

To view the API token

http://localhost:8000/token

If you are not going to be using API tokens then you can remove the route from config/routes.php

Creating App Source

To install the source into your app, and rename the namespaces, type in

$ bin/console user-authentication:install

Copy and paste the routes from plugins/user_authentication/config/routes.php to the config/routes.php

Copy the database schema from plugins/user_authentication/database/schema.php either into your existing schema file database/schema.php or into a new file.

Uninstall the Plugin

$ composer remove originphp/user_authentication

What Next

Now its all working fine, it is time to copy the schema for the User Authentication plugin and the queues into your application/schema.php.

Testing The Plugin

The controller integration test requires your AppController loads the AuthComponent, but other tests will run fine without this.

Load the schema for the UserAuthentication plugin and queues into the test database

$ bin/console db:schema:load --connection=test UserAuthentication.schema
$ bin/console db:schema:load --connection=test queue

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固