]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Owa.php
Translated string will never match what's saved in DB if not english
[friendica.git] / src / Module / Owa.php
index a1dbfa2f315ea3aa8b31d9f2f12e5ae99854f5b9..7243c111344b4d159e5fa6d5a86b701936ecd241 100644 (file)
@@ -11,6 +11,7 @@ use Friendica\Database\DBA;
 use Friendica\Model\Contact;
 use Friendica\Model\OpenWebAuthToken;
 use Friendica\Util\HTTPSignature;
+use Friendica\Util\Strings;
 
 /**
  * @brief OpenWebAuth verifier and token generator
@@ -62,7 +63,7 @@ class Owa extends BaseModule
                                                                Logger::log('OWA success: ' . $contact['addr'], Logger::DATA);
 
                                                                $ret['success'] = true;
-                                                               $token = random_string(32);
+                                                               $token = Strings::getRandomHex(32);
 
                                                                // Store the generated token in the databe.
                                                                OpenWebAuthToken::create('owt', 0, $token, $contact['addr']);
@@ -74,7 +75,7 @@ class Owa extends BaseModule
                                                                // At a later time, we will compare weather the token we're getting
                                                                // is really the same token we have stored in the database.
                                                                openssl_public_encrypt($token, $result, $contact['pubkey']);
-                                                               $ret['encrypted_token'] = base64url_encode($result);
+                                                               $ret['encrypted_token'] = Strings::base64UrlEncode($result);
                                                        } else {
                                                                Logger::log('OWA fail: ' . $contact['id'] . ' ' . $contact['addr'] . ' ' . $contact['url'], Logger::DEBUG);
                                                        }
@@ -85,6 +86,6 @@ class Owa extends BaseModule
                                }
                        }
                }
-               System::jsonExit($ret, 'application/x-dfrn+json');
+               System::jsonExit($ret, 'application/x-zot+json');
        }
 }