Validate that an account secret is valid base32.

master
Johan Ouwerkerk 2020-01-27 22:40:17 +01:00
parent ea81dafb8e
commit 26d6d62cbe
2 changed files with 4 additions and 2 deletions

View File

@ -80,7 +80,7 @@ void AccountValidationTest::checkSecret_data()
QTest::newRow("null value") << QString() << false;
QTest::newRow("empty secret") << QString(QLatin1String("")) << false;
QTest::newRow("valid secret") << QString(QLatin1String("something")) << true;
QTest::newRow("valid secret") << QString(QLatin1String("ONSWG4TFOQ======")) << true;
}
void AccountValidationTest::checkTokenLength_data()

View File

@ -4,6 +4,8 @@
*/
#include "validation.h"
#include "../base32/base32.h"
namespace accounts
{
@ -14,7 +16,7 @@ namespace accounts
bool checkSecret(const QString &secret)
{
return !secret.isEmpty();
return !secret.isEmpty() && base32::validate(secret);
}
bool checkName(const QString &name)