port hubzillas OpenWebAuth - fix wrong table name + fix wrong method name

2022.09-rc
rabuzarus 2018-06-20 20:11:26 +02:00
rodzic e4aaf8eb16
commit 9f493357f4
2 zmienionych plików z 8 dodań i 8 usunięć

Wyświetl plik

@ -10,12 +10,12 @@ use Friendica\Util\DateTimeFormat;
use dba;
/**
* Methods to deal with entries of the 'openwebauth_token' table.
* Methods to deal with entries of the 'openwebauth-token' table.
*/
class OpenWebAuthToken
{
/**
* Create an entry in the 'openwebauth_token' table.
* Create an entry in the 'openwebauth-token' table.
*
* @param string $type Verify type.
* @param int $uid The user ID.
@ -33,11 +33,11 @@ class OpenWebAuthToken
"meta" => $meta,
"created" => DateTimeFormat::utcNow()
];
return dba::insert("openwebauth_token", $fields);
return dba::insert("openwebauth-token", $fields);
}
/**
* Get the "meta" field of an entry in the openwebauth_token table.
* Get the "meta" field of an entry in the openwebauth-token table.
*
* @param string $type Verify type.
* @param int $uid The user ID.
@ -49,9 +49,9 @@ class OpenWebAuthToken
{
$condition = ["type" => $type, "uid" => $uid, "token" => $token];
$entry = dba::selectFirst("openwebauth_token", ["id", "meta"], $condition);
$entry = dba::selectFirst("openwebauth-token", ["id", "meta"], $condition);
if (DBM::is_result($entry)) {
dba::delete("openwebauth_token", ["id" => $entry["id"]]);
dba::delete("openwebauth-token", ["id" => $entry["id"]]);
return $entry["meta"];
}
@ -67,7 +67,7 @@ class OpenWebAuthToken
public static function purge($type, $interval)
{
$condition = ["`type` = ? AND `created` < ?", $type, DateTimeFormat::utcNow() . " - INTERVAL " . $interval];
dba::delete("openwebauth_token", $condition);
dba::delete("openwebauth-token", $condition);
}
}

Wyświetl plik

@ -394,7 +394,7 @@ class Crypto
$key = random_bytes(32);
$iv = random_bytes(16);
$result = ['encrypted' => true];
$result['data'] = base64url_encode(self::AES256CBC_encrypt($data, $key, $iv), true);
$result['data'] = base64url_encode(self::encryptAES256CBC($data, $key, $iv), true);
// log the offending call so we can track it down
if (!openssl_public_encrypt($key, $k, $pubkey)) {