mirror of
				https://github.com/kunkundi/crossdesk.git
				synced 2025-10-26 20:25:34 +08:00 
			
		
		
		
	[feat] only a six-char password will be accepted
This commit is contained in:
		| @@ -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> cancel = {u8"取消", "Cancel"}; | ||||
|  | ||||
| static std::vector<std::string> new_password = {u8"请输入新密码:", | ||||
|                                                 "Please input new password:"}; | ||||
| static std::vector<std::string> new_password = { | ||||
|     u8"请输入六位密码:", "Please input a six-char password:"}; | ||||
|  | ||||
| static std::vector<std::string> input_password = {u8"请输入密码:", | ||||
|                                                   "Please input password:"}; | ||||
| static std::vector<std::string> validate_password = {u8"验证密码中...", | ||||
|   | ||||
| @@ -266,17 +266,23 @@ int Render::LocalWindow() { | ||||
|         ImGui::SetCursorPosY(window_height * 0.75f); | ||||
|  | ||||
|         // OK | ||||
|         if (enter_pressed || | ||||
|             ImGui::Button( | ||||
|                 localization::ok[localization_language_index_].c_str())) { | ||||
|           show_reset_password_window_ = false; | ||||
|           LOG_INFO("Generate new password and save into cache file"); | ||||
|           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; | ||||
|         if (ImGui::Button( | ||||
|                 localization::ok[localization_language_index_].c_str()) || | ||||
|             enter_pressed) { | ||||
|           if (6 != strlen(new_password_)) { | ||||
|             LOG_ERROR("Invalid password length"); | ||||
|             show_reset_password_window_ = true; | ||||
|             focus_on_input_widget_ = true; | ||||
|           } else { | ||||
|             show_reset_password_window_ = false; | ||||
|             LOG_INFO("Generate new password and save into cache file"); | ||||
|             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(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user