52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
#pragma once
|
||
|
||
// 登录窗(Phase 3):验证码图(本地绘制服务端明文答案)+ RSA 真实登录。
|
||
// 成功后 accept() 并经 token() 暴露 accessToken 给主流程注入 ApiClient。
|
||
|
||
#include <QDialog>
|
||
#include <QString>
|
||
|
||
class QCheckBox;
|
||
class QLabel;
|
||
class QLineEdit;
|
||
class QPushButton;
|
||
|
||
namespace geopro::net {
|
||
class AuthService;
|
||
}
|
||
|
||
namespace geopro::app {
|
||
|
||
class LoginWindow : public QDialog {
|
||
Q_OBJECT
|
||
|
||
public:
|
||
explicit LoginWindow(geopro::net::AuthService& auth, QWidget* parent = nullptr);
|
||
|
||
// 登录成功后的 accessToken(形如 "Geomative <hash>");未登录为空。
|
||
QString token() const { return token_; }
|
||
|
||
// 用户是否勾选「记住登录」(成功后据此决定是否安全存储 token)。
|
||
bool remember() const;
|
||
|
||
private:
|
||
void refreshCaptcha(); // 拉新验证码并重绘图片
|
||
void attemptLogin(); // 校验输入并发起阻塞登录
|
||
void showError(const QString& msg);
|
||
|
||
geopro::net::AuthService& auth_;
|
||
QString token_;
|
||
QString codeId_;
|
||
|
||
QLineEdit* userEdit_ = nullptr;
|
||
QLineEdit* pwdEdit_ = nullptr;
|
||
QLineEdit* codeEdit_ = nullptr;
|
||
QLabel* captchaLabel_ = nullptr;
|
||
QPushButton* refreshBtn_ = nullptr;
|
||
QPushButton* loginBtn_ = nullptr;
|
||
QCheckBox* rememberChk_ = nullptr;
|
||
QLabel* errorLabel_ = nullptr;
|
||
};
|
||
|
||
} // namespace geopro::app
|