mirror of
https://github.com/QuasarApp/Snake.git
synced 2025-05-10 00:19:45 +00:00
added support of solt
This commit is contained in:
parent
a54c4a7343
commit
4003999898
@ -12,8 +12,10 @@
|
|||||||
#include "login.h"
|
#include "login.h"
|
||||||
#include "updateplayerdata.h"
|
#include "updateplayerdata.h"
|
||||||
|
|
||||||
|
#define SOLT "SNAKE"
|
||||||
namespace ClientProtocol {
|
namespace ClientProtocol {
|
||||||
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
Command Client::checkCommand(int sig, Command reqCmd, Type type) {
|
Command Client::checkCommand(int sig, Command reqCmd, Type type) {
|
||||||
|
|
||||||
@ -194,6 +196,13 @@ bool Client::ping() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Do not change the order of this function,
|
||||||
|
/// as this may lead to the loss of user accounts.
|
||||||
|
QByteArray Client::generateHash(const QByteArray& pass) const {
|
||||||
|
auto passHash = QCryptographicHash::hash(pass, QCryptographicHash::Sha256);
|
||||||
|
return QCryptographicHash::hash(SOLT + passHash, QCryptographicHash::Sha256);
|
||||||
|
}
|
||||||
|
|
||||||
bool Client::login(const QString &gmail, const QByteArray &pass) {
|
bool Client::login(const QString &gmail, const QByteArray &pass) {
|
||||||
if (!pass.size()) {
|
if (!pass.size()) {
|
||||||
return false;
|
return false;
|
||||||
@ -211,9 +220,7 @@ bool Client::login(const QString &gmail, const QByteArray &pass) {
|
|||||||
|
|
||||||
Login login;
|
Login login;
|
||||||
|
|
||||||
login.setHashPass(QRSAEncryption::encodeS(
|
login.setHashPass(QRSAEncryption::encodeS(generateHash(pass), _rsaKey));
|
||||||
QCryptographicHash::hash(pass, QCryptographicHash::Sha256),
|
|
||||||
_rsaKey));
|
|
||||||
login.setGmail(gmail);
|
login.setGmail(gmail);
|
||||||
login.setId(0);
|
login.setId(0);
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ private:
|
|||||||
|
|
||||||
bool ping();
|
bool ping();
|
||||||
|
|
||||||
|
QByteArray generateHash(const QByteArray &pass) const;
|
||||||
|
|
||||||
void updateStatuses(Command extCmd, Command cmd, Type type, const QByteArray &obj);
|
void updateStatuses(Command extCmd, Command cmd, Type type, const QByteArray &obj);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user