承接 leandrolugaresi/google-authenticator 相关项目开发

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

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

leandrolugaresi/google-authenticator

最新稳定版本:1.0.1

Composer 安装命令:

composer require leandrolugaresi/google-authenticator

包简介

PHP repository for Google Authenticator

README 文档

README

[DEPRECATED] use the antonioribeiro/google2fa instead!

Latest Stable Version Total Downloads Latest Unstable Version License Codeship Status for leandro-lugaresi/google-authenticator

Introduction

This is a module to integrate web sites with Google Authenticator.

Requirements

Installation

  1. Add this project in your composer.json:
    "require": {
        "leandrolugaresi/google-authenticator": "1.0.*"
    }
  1. Now tell the composer to download the repository by running the command:
    $ php composer.phar update

Usage

Step 1 - Register application

Show the QrCode and the form:

    $googleAuth = new \GoogleAuthenticator\GoogleAuthenticator();
    $googleAuth->setIssuer('YourApplicationName');
    //save the secretKey to register after
    $_SESSION['secretKeyTemp'] = $googleAuth->getSecretKey();

    // Show the qrcode to register
    //this param is an identifier of the user in this application
    echo $googleAuth->getQRCodeUrl($user->username.'@YourApplicationName');

Verify the code from form and save the secretKey of this user:

    $google = new GoogleAuthenticator($_SESSION['secretKeyTemp']);
    $userSubmitCode = $_POST['codeFoo'];
    if ($google->verifyCode($userSubmitCode)) {
        //save the secretKey of this user
    }

Step 2 - Verify Code at login

    $google = new GoogleAuthenticator($user->getSecretKey());
    $userSubmitCode = $_POST['codeFoo'];

    // Verify Code
    if ($google->verifyCode($userSubmitCode)) {

        // OK - aloowed login
    }

统计信息

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

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2014-09-19