move OTPHP to vendor/; additionally move Base32 class to OTPHP namespace

master
Andrew Dolgov 6 years ago
parent df47100ad1
commit 310c18e6bb

@ -848,9 +848,6 @@ class Pref_Prefs extends Handler_Protected {
}
function otpqrcode() {
require_once "lib/otphp/vendor/base32.php";
require_once "lib/otphp/lib/otp.php";
require_once "lib/otphp/lib/totp.php";
require_once "lib/phpqrcode/phpqrcode.php";
$sth = $this->pdo->prepare("SELECT login,salt,otp_enabled
@ -860,7 +857,7 @@ class Pref_Prefs extends Handler_Protected {
if ($row = $sth->fetch()) {
$base32 = new Base32();
$base32 = new \OTPHP\Base32();
$login = $row["login"];
$otp_enabled = sql_bool_to_bool($row["otp_enabled"]);
@ -876,9 +873,6 @@ class Pref_Prefs extends Handler_Protected {
}
function otpenable() {
require_once "lib/otphp/vendor/base32.php";
require_once "lib/otphp/lib/otp.php";
require_once "lib/otphp/lib/totp.php";
$password = clean($_REQUEST["password"]);
$otp = clean($_REQUEST["otp"]);
@ -894,7 +888,7 @@ class Pref_Prefs extends Handler_Protected {
if ($row = $sth->fetch()) {
$base32 = new Base32();
$base32 = new \OTPHP\Base32();
$secret = $base32->encode(sha1($row["salt"]));
$topt = new \OTPHP\TOTP($secret);

@ -1,26 +0,0 @@
<?php
/*
* Copyright (c) 2011 Le Lag
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
// Add any needed third party library to this directory
//require_once dirname(__FILE__).'/some_lib/lib.php';
require_once dirname(__FILE__).'/base32.php';

@ -1,5 +1,7 @@
<?php
namespace OTPHP;
/**
* Encode in Base32 based on RFC 4648.
* Requires 20% more space than base64

@ -99,7 +99,7 @@ class OTP {
* @return binary secret key
*/
public function byteSecret() {
return \Base32::decode($this->secret);
return Base32::decode($this->secret);
}
/**
Loading…
Cancel
Save