Validate that an account secret is valid base32.
parent
ea81dafb8e
commit
26d6d62cbe
|
@ -80,7 +80,7 @@ void AccountValidationTest::checkSecret_data()
|
||||||
|
|
||||||
QTest::newRow("null value") << QString() << false;
|
QTest::newRow("null value") << QString() << false;
|
||||||
QTest::newRow("empty secret") << QString(QLatin1String("")) << 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()
|
void AccountValidationTest::checkTokenLength_data()
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
*/
|
*/
|
||||||
#include "validation.h"
|
#include "validation.h"
|
||||||
|
|
||||||
|
#include "../base32/base32.h"
|
||||||
|
|
||||||
namespace accounts
|
namespace accounts
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -14,7 +16,7 @@ namespace accounts
|
||||||
|
|
||||||
bool checkSecret(const QString &secret)
|
bool checkSecret(const QString &secret)
|
||||||
{
|
{
|
||||||
return !secret.isEmpty();
|
return !secret.isEmpty() && base32::validate(secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checkName(const QString &name)
|
bool checkName(const QString &name)
|
||||||
|
|
Loading…
Reference in New Issue