/
Shymer123
/
Messenger
Обзор
Документация
Войти
/
Shymer123
/
Messenger
Код
Запросы
0
Задачи
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
UI_Client/SourceFiles/authorization.h
80 строк
2 KB
Shymer123
The architecture has been completely changed and a white theme has been added.
04 фев 2025, 14:32
04 фев 2025, 14:32
d5e24f4
Код
Авторство
О чём код?
#ifndef AUTHORIZATION_H #define AUTHORIZATION_H #include <QWidget> #include <openssl/evp.h> #include <openssl/rand.h> namespace Ui { namespace Widgets { class PhoneLineEdit; } } class CommunicationHandler; class QTcpSocket; class QVBoxLayout; class QHBoxLayout; class QFormLayout; class QLabel; class QLineEdit; class QPushButton; const int PORT = 8080; class Authorization : public QWidget { public: explicit Authorization(QWidget *parent = nullptr); private: QTcpSocket* clientSocket; int m_userID; QString m_userName; QString m_password; QString m_phoneNumber; CommunicationHandler* handler; QVBoxLayout* vLayout; QHBoxLayout* hLayout; QFormLayout* formLayout; QLabel* topNameLabel; QLabel* infoLabel; QLineEdit* nickEdit; QLabel* phoneLabel; Ui::Widgets::PhoneLineEdit* phoneEdit; QLineEdit* passwordEdit; QLabel* authPageLabel; QPushButton* authPageButton; QPushButton* authButton; void connectServer(); void Registration(); void Entrance(); void buildWidgets(); void connection(); private slots: void regimeChange(); void authActions(); void onIsPhoneAlreadyUseReceived(const QJsonObject& response); void onIsNameAlreadyUseReceived(const QJsonObject& response); void onStoredPasswordDataReceived(const QJsonObject& response); void onUserIDReceived(const QJsonObject& response); void onPhoneNumberReceived(const QJsonObject& response); private: QByteArray generateSalt(int length); QByteArray hashPassword(const QString& password, const QByteArray& salt); void savePassword(const QString& username, const QString& password, const QString& phoneNumber); void getStoredPasswordData(); bool checkPassword(const QString &username, const QString &password); bool isNameValid(); bool isPasswordValid(); //register method void isPhoneNumberAlreadyUse(); void isNameAlreadyUse(); }; #endif // AUTHORIZATION_H