承接 fragotesac/zf1-2fa 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

fragotesac/zf1-2fa

最新稳定版本:v1.5

Composer 安装命令:

composer require fragotesac/zf1-2fa

包简介

Zend Framework 1 2FA component

README 文档

README

This PHP library provides two-factor authentication (2FA) functionality for Zend Framework 1 applications. It allows for secure user login by requiring an additional step of verification, enhancing application security.

How to Use

Backend Configuration

  1. Create an Action:
    Implement an action in your backend where 2FA will be handled.

  2. Instantiate the 2FA Service:

    $this->tfa = new \Zend\TwoFactorAuth();
  1. Set Mail Configuration:
    $this->tfa->setMailConfig([
        'transport' => [],      // Mail transport settings
        'subject'   => '',      // Email subject for 2FA codes
        'from'      => ['email' => '', 'name' => ''],  // Sender details
        'template'  => []       // Email template configuration
    ]);
  1. Initialize the 2FA Service: Call the init method with a callback function to validate the user:
    $this->tfa->init([$this, 'checkUser']);
  1. Implement the checkUser Method: This method should handle user validation and error management using Zend\Util\ResponseUtil.

Client-Side Setup

  1. Copy the Client Folder:
    Copy the 2fa-client folder located inside src and place it in your public/js/ directory.

  2. Initialize the 2FA Client:
    Use the following JavaScript code to initialize the 2FA client:

   zfTwoFactorAuth.init(apiUrl, data, 'glass-theme', (loginFormData, url) => {
        // Handle the login callback here
   });
  • apiUrl: The API endpoint previously created for 2FA.
  • data: The login form fields converted into an object, e.g., {username: 'joe', password: 123456}.
  • glass-theme: The style theme for the 2FA modal. Available themes are: glass-theme cds-theme
  • Callback Function: Handles the login URL and sanitized parameters.

Requirements

  • Zend Framework 1
  • PHP 8.0 or higher
  • Composer for dependency management

Installation

   composer require fragotesac/zf1-2fa

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2025-01-15