Skip to content

Commit

Permalink
Merge branch 'main' of https://gitee.com/opguess/QSyncUi
Browse files Browse the repository at this point in the history
  • Loading branch information
RaidenShogunShadow committed Jul 10, 2024
2 parents 23d2054 + d4a74e6 commit 0cac99b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ void MainWindow::onUserLoggedIn(User user)
CurrentUser=new User(user);
connect(CurrentUser->channel,&MessageChannel::message,this,&MainWindow::onMessage);
_userinfopage->currentUser=CurrentUser;
_modifyInfor_win->currentUser=CurrentUser;
db->insertUser(user.getEmail(),user.gethashedPassword());
setUserInfoCardTitle(user.getUsername());
setUserInfoCardSubTitle(user.getEmail());
Expand Down
4 changes: 3 additions & 1 deletion modifyinfor_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ void modifyInfor_win::onConfirmButtonClicked()
QMessageBox::warning(this, "错误", "两次输入的密码不一致。");
return;
}

currentUser->username = newId;
currentUser->hashedPassword = newPassword;
currentUser->updateUser();
// 更新数据库
emit changexinxi(User(*currentUser));
currentUser->username = newId;
Expand Down
14 changes: 12 additions & 2 deletions user.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,17 @@ bool User::getisLogin()
// return session;
}*/

bool User::updateUser(User &user)
bool User::updateUser()
{
return true;
QString postData = QString("username=%1&password=%2").arg(this->username).arg(this->hashedPassword);
ApiResponse response = apiRequest->post("/updateInfo", postData.toUtf8());
if (response.isSuccess())
{
return true;
}
else
{
emit channel->message(response.message, "Error");
return false;
}
}
2 changes: 1 addition & 1 deletion user.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class User : public QObject
TaskToken getTaskToken(int id);//获取tasktoken
TaskToken getTaskTokenByRemote(QString s3Dir);
bool logout();//登出
bool updateUser(User &user);
bool updateUser();
QString getS3Location();//获取云端容器地址
QString getUsername();//获取用户名
QString getEmail();//获取用户邮箱
Expand Down

0 comments on commit 0cac99b

Please sign in to comment.