mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 12:15:34 +08:00
[feat] only a six-char password will be accepted
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -51,8 +51,9 @@ static std::vector<std::string> enable_turn = {u8"启用中继服务:",
|
|||||||
static std::vector<std::string> ok = {u8"确认", "OK"};
|
static std::vector<std::string> ok = {u8"确认", "OK"};
|
||||||
static std::vector<std::string> cancel = {u8"取消", "Cancel"};
|
static std::vector<std::string> cancel = {u8"取消", "Cancel"};
|
||||||
|
|
||||||
static std::vector<std::string> new_password = {u8"请输入新密码:",
|
static std::vector<std::string> new_password = {
|
||||||
"Please input new password:"};
|
u8"请输入六位密码:", "Please input a six-char password:"};
|
||||||
|
|
||||||
static std::vector<std::string> input_password = {u8"请输入密码:",
|
static std::vector<std::string> input_password = {u8"请输入密码:",
|
||||||
"Please input password:"};
|
"Please input password:"};
|
||||||
static std::vector<std::string> validate_password = {u8"验证密码中...",
|
static std::vector<std::string> validate_password = {u8"验证密码中...",
|
||||||
|
|||||||
@@ -266,17 +266,23 @@ int Render::LocalWindow() {
|
|||||||
ImGui::SetCursorPosY(window_height * 0.75f);
|
ImGui::SetCursorPosY(window_height * 0.75f);
|
||||||
|
|
||||||
// OK
|
// OK
|
||||||
if (enter_pressed ||
|
if (ImGui::Button(
|
||||||
ImGui::Button(
|
localization::ok[localization_language_index_].c_str()) ||
|
||||||
localization::ok[localization_language_index_].c_str())) {
|
enter_pressed) {
|
||||||
show_reset_password_window_ = false;
|
if (6 != strlen(new_password_)) {
|
||||||
LOG_INFO("Generate new password and save into cache file");
|
LOG_ERROR("Invalid password length");
|
||||||
strncpy(password_saved_, new_password_, sizeof(password_saved_));
|
show_reset_password_window_ = true;
|
||||||
memset(new_password_, 0, sizeof(new_password_));
|
focus_on_input_widget_ = true;
|
||||||
SaveSettingsIntoCacheFile();
|
} else {
|
||||||
LeaveConnection(peer_, client_id_);
|
show_reset_password_window_ = false;
|
||||||
is_create_connection_ = false;
|
LOG_INFO("Generate new password and save into cache file");
|
||||||
focus_on_input_widget_ = true;
|
strncpy(password_saved_, new_password_, sizeof(password_saved_));
|
||||||
|
memset(new_password_, 0, sizeof(new_password_));
|
||||||
|
SaveSettingsIntoCacheFile();
|
||||||
|
LeaveConnection(peer_, client_id_);
|
||||||
|
is_create_connection_ = false;
|
||||||
|
focus_on_input_widget_ = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|||||||
Reference in New Issue
Block a user