重置密码label
当我们在登录忘记密码的时候可以支持重置密码,重置密码label也要实现浮动和点击效果,以及未点击效果。所以我们复用之前的ClickedLabel,
在登录界面中升级forget_label为ClickedLabel。
1 | LoginDialog::LoginDialog(QWidget *parent) : |
点击忘记密码发送对应的信号
1 | void LoginDialog::slot_forget_pwd() |
我们在mainwindow中连接了重置密码的信号和槽
1 | //连接登录界面忘记密码信号 |
实现SlotSwitchReset
1 | void MainWindow::SlotSwitchReset() |
ResetDialog是我们添加的界面类,新建ResetDialog界面类,界面布局如下
重置界面
1 |
|
下面是检测逻辑
1 | bool ResetDialog::checkUserValid() |
显示接口
1 | void ResetDialog::showTip(QString str, bool b_ok) |
获取验证码
1 | void ResetDialog::on_varify_btn_clicked() |
初始化回包处理逻辑
1 | void ResetDialog::initHandlers() |
根据返回的id调用不同的回报处理逻辑
1 | void ResetDialog::slot_reset_mod_finish(ReqId id, QString res, ErrorCodes err) |
这里实现发送逻辑
1 | void ResetDialog::on_sure_btn_clicked() |
注册、重置、登录切换
我们要实现注册、重置、登录三个界面的替换,就需要在MainWindow中添加SlotSwitchLogin2的实现
1 | //从重置界面返回登录界面 |
服务端响应重置
在LogicSystem的构造函数中增加注册逻辑
1 | //重置回调逻辑 |
在Mysql中新增CheckEmail和UpdatePwd函数
1 | bool MysqlMgr::CheckEmail(const std::string& name, const std::string& email) { |
DAO这一层写具体的逻辑, 检测邮箱是否合理
1 | bool MysqlDao::CheckEmail(const std::string& name, const std::string& email) { |
更新密码
1 | bool MysqlDao::UpdatePwd(const std::string& name, const std::string& newpwd) { |