Server: client-server logic implementation#17
Conversation
Update get_project_endpoint
…omplete auth service
…nge_project_title
Server : ProjectDAO
Server : project endpoints
Server: authorization endpoint
Server : projects to async
There was a problem hiding this comment.
Pull Request Overview
This PR implements several changes related to the client‐server logic and UI improvements. Key updates include renaming UI widget object names for consistency and clarity, introducing a new theme switch button (“switch_theme”), and adding/integrating gRPC client logic with authentication and update requests in the CMake configuration.
Reviewed Changes
Copilot reviewed 98 out of 98 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| client/ui/authorization-windows/ui/login_window.ui | Renamed widgets and updated geometries; added new “switch_theme” button. |
| client/ui/authorization-windows/src/registration_window.cpp | Updated UI elements and added theming logic; refactored widget names and event handling. |
| client/ui/authorization-windows/src/login_window.cpp | Updated login UI with widget renames and theming support. |
| client/ui/authorization-windows/include/registration_window.h client/ui/authorization-windows/include/login_window.h |
Added final specifiers, counter initialization, and method adjustments to support new theme logic. |
| Various CMakeLists.txt files | Updated linking and sanitizer options; added dependencies such as ThemeManager and Client modules. |
| client/client/src/update_requests.cpp client/client/src/auth_requests.cpp client/client/src/client_implementation.cpp |
Integrated and adjusted gRPC client calls for updating and authenticating users; improved logging. |
| client/client/include/* | Added and adjusted header definitions for gRPC client call abstractions. |
| void RegistrationWindow::on_push_registration_clicked() { | ||
| if (this->counter_on_switch_theme_clicks++ % 2) { | ||
| const QString created_login = ui->create_login->text(); | ||
| const QString created_password = ui->create_password->text(); | ||
| const QString repeated_password = ui->repeat_password->text(); | ||
|
|
||
| if (!created_login.isEmpty() && !created_password.isEmpty() && | ||
| !repeated_password.isEmpty()) { | ||
| if (created_password != repeated_password) { | ||
| QMessageBox::warning(this, "Ошибка", "Пароли не совпадают!"); | ||
| } else if (created_login.size() > 50) { | ||
| QMessageBox::warning( | ||
| this, "Ошибка", | ||
| "Длина логина не должна превышать пятидесяти символов" | ||
| ); | ||
| } else if (created_password.size() > 50) { | ||
| QMessageBox::warning( | ||
| this, "Ошибка", | ||
| "Длина пароля не должна превышать пятидесяти символов" | ||
| ); | ||
| } else if (is_strong_and_valid_password(created_password)) { | ||
| auto user = new User(); | ||
| user->set_login(created_login.toStdString()); | ||
| user->set_hashed_password(created_password.toStdString()); | ||
|
|
||
| const int try_register_user = | ||
| ClientImplementation::get_instance().try_register_user(user | ||
| ); | ||
| if (try_register_user == 0) { | ||
| QMessageBox::warning( | ||
| this, "Ошибка", | ||
| "Извините, внутренняя ошибка с базами данных." | ||
| ); | ||
| } else if (try_register_user == -1) { | ||
| QMessageBox::warning( | ||
| this, "Ошибка", | ||
| "Пользователь с таким именем уже существует. " | ||
| "Пожалуйста, " | ||
| "придумайте другое!" | ||
| ); | ||
| } else { | ||
| QMessageBox::information( | ||
| this, "Регистрация", | ||
| "Вы успешно зарегистрировались! Пожалуйста, выполните " | ||
| "вход." | ||
| ); | ||
| on_switch_mode_clicked(); | ||
| } | ||
| } | ||
| } else { | ||
| QMessageBox::warning( | ||
| this, "Ошибка", "Пожалуйста, заполните все поля." | ||
| ); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
The use of counter_on_switch_theme_clicks to gate execution in on_push_registration_clicked may unintentionally block registration logic on every alternate click. Consider using a dedicated mechanism or removing the modulo check if the intent is to process every click.
| void RegistrationWindow::on_push_registration_clicked() { | |
| if (this->counter_on_switch_theme_clicks++ % 2) { | |
| const QString created_login = ui->create_login->text(); | |
| const QString created_password = ui->create_password->text(); | |
| const QString repeated_password = ui->repeat_password->text(); | |
| if (!created_login.isEmpty() && !created_password.isEmpty() && | |
| !repeated_password.isEmpty()) { | |
| if (created_password != repeated_password) { | |
| QMessageBox::warning(this, "Ошибка", "Пароли не совпадают!"); | |
| } else if (created_login.size() > 50) { | |
| QMessageBox::warning( | |
| this, "Ошибка", | |
| "Длина логина не должна превышать пятидесяти символов" | |
| ); | |
| } else if (created_password.size() > 50) { | |
| QMessageBox::warning( | |
| this, "Ошибка", | |
| "Длина пароля не должна превышать пятидесяти символов" | |
| ); | |
| } else if (is_strong_and_valid_password(created_password)) { | |
| auto user = new User(); | |
| user->set_login(created_login.toStdString()); | |
| user->set_hashed_password(created_password.toStdString()); | |
| const int try_register_user = | |
| ClientImplementation::get_instance().try_register_user(user | |
| ); | |
| if (try_register_user == 0) { | |
| QMessageBox::warning( | |
| this, "Ошибка", | |
| "Извините, внутренняя ошибка с базами данных." | |
| ); | |
| } else if (try_register_user == -1) { | |
| QMessageBox::warning( | |
| this, "Ошибка", | |
| "Пользователь с таким именем уже существует. " | |
| "Пожалуйста, " | |
| "придумайте другое!" | |
| ); | |
| } else { | |
| QMessageBox::information( | |
| this, "Регистрация", | |
| "Вы успешно зарегистрировались! Пожалуйста, выполните " | |
| "вход." | |
| ); | |
| on_switch_mode_clicked(); | |
| } | |
| } | |
| } else { | |
| QMessageBox::warning( | |
| this, "Ошибка", "Пожалуйста, заполните все поля." | |
| ); | |
| } | |
| } | |
| } | |
| void RegistrationWindow::on_push_registration_clicked() { | |
| const QString created_login = ui->create_login->text(); | |
| const QString created_password = ui->create_password->text(); | |
| const QString repeated_password = ui->repeat_password->text(); | |
| if (!created_login.isEmpty() && !created_password.isEmpty() && | |
| !repeated_password.isEmpty()) { | |
| if (created_password != repeated_password) { | |
| QMessageBox::warning(this, "Ошибка", "Пароли не совпадают!"); | |
| } else if (created_login.size() > 50) { | |
| QMessageBox::warning( | |
| this, "Ошибка", | |
| "Длина логина не должна превышать пятидесяти символов" | |
| ); | |
| } else if (created_password.size() > 50) { | |
| QMessageBox::warning( | |
| this, "Ошибка", | |
| "Длина пароля не должна превышать пятидесяти символов" | |
| ); | |
| } else if (is_strong_and_valid_password(created_password)) { | |
| auto user = new User(); | |
| user->set_login(created_login.toStdString()); | |
| user->set_hashed_password(created_password.toStdString()); | |
| const int try_register_user = | |
| ClientImplementation::get_instance().try_register_user(user | |
| ); | |
| if (try_register_user == 0) { | |
| QMessageBox::warning( | |
| this, "Ошибка", | |
| "Извините, внутренняя ошибка с базами данных." | |
| ); | |
| } else if (try_register_user == -1) { | |
| QMessageBox::warning( | |
| this, "Ошибка", | |
| "Пользователь с таким именем уже существует. " | |
| "Пожалуйста, " | |
| "придумайте другое!" | |
| ); | |
| } else { | |
| QMessageBox::information( | |
| this, "Регистрация", | |
| "Вы успешно зарегистрировались! Пожалуйста, выполните " | |
| "вход." | |
| ); | |
| on_switch_mode_clicked(); | |
| } | |
| } | |
| } else { | |
| QMessageBox::warning( | |
| this, "Ошибка", "Пожалуйста, заполните все поля." | |
| ); | |
| } | |
| } |
| void LoginWindow::on_push_enter_clicked() { | ||
| if (this->counter_on_switch_theme_clicks++ % 2) { | ||
| const QString login = ui->input_login->text(); | ||
| const QString password = ui->input_password->text(); | ||
|
|
||
| auto user = new User(); | ||
| user->set_login(login.toStdString()); | ||
| user->set_hashed_password(password.toStdString()); | ||
|
|
||
| if (!login.isEmpty() && !password.isEmpty()) { | ||
| if (login.size() > 50) { | ||
| QMessageBox::warning( | ||
| this, "Ошибка", | ||
| "Длина логина не должна превышать пятидесяти символов" | ||
| ); | ||
| } else if (password.size() > 50) { | ||
| QMessageBox::warning( | ||
| this, "Ошибка", | ||
| "Длина пароля не должна превышать пятидесяти символов" | ||
| ); | ||
| } else if (ClientImplementation::get_instance() | ||
| .try_authenticate_user(user)) { | ||
| QMessageBox::information( | ||
| this, "Вход", "Вы успешно вошли! Добро пожаловать :)" | ||
| ); | ||
| QWidget *parent = this->parentWidget(); | ||
|
|
||
| const QMainWindow *app_window = | ||
| qobject_cast<QMainWindow *>(parent); | ||
|
|
||
| if (QWidget *old = app_window->centralWidget()) { | ||
| old->deleteLater(); | ||
| } | ||
|
|
||
| this->close(); | ||
| } else { | ||
| QMessageBox::warning( | ||
| this, "Ошибка ввода данных", "Неверный логин или пароль!" | ||
| ); | ||
| } | ||
| } else { | ||
| QMessageBox::warning( | ||
| this, "Ошибка ввода данных", "Пожалуйста, заполните все поля!" | ||
| ); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Gating the on_push_enter_clicked action with a counter modulo check may result in inconsistent login behavior. It is recommended to remove or separate this counter from the login event handling.
| void LoginWindow::on_push_enter_clicked() { | |
| if (this->counter_on_switch_theme_clicks++ % 2) { | |
| const QString login = ui->input_login->text(); | |
| const QString password = ui->input_password->text(); | |
| auto user = new User(); | |
| user->set_login(login.toStdString()); | |
| user->set_hashed_password(password.toStdString()); | |
| if (!login.isEmpty() && !password.isEmpty()) { | |
| if (login.size() > 50) { | |
| QMessageBox::warning( | |
| this, "Ошибка", | |
| "Длина логина не должна превышать пятидесяти символов" | |
| ); | |
| } else if (password.size() > 50) { | |
| QMessageBox::warning( | |
| this, "Ошибка", | |
| "Длина пароля не должна превышать пятидесяти символов" | |
| ); | |
| } else if (ClientImplementation::get_instance() | |
| .try_authenticate_user(user)) { | |
| QMessageBox::information( | |
| this, "Вход", "Вы успешно вошли! Добро пожаловать :)" | |
| ); | |
| QWidget *parent = this->parentWidget(); | |
| const QMainWindow *app_window = | |
| qobject_cast<QMainWindow *>(parent); | |
| if (QWidget *old = app_window->centralWidget()) { | |
| old->deleteLater(); | |
| } | |
| this->close(); | |
| } else { | |
| QMessageBox::warning( | |
| this, "Ошибка ввода данных", "Неверный логин или пароль!" | |
| ); | |
| } | |
| } else { | |
| QMessageBox::warning( | |
| this, "Ошибка ввода данных", "Пожалуйста, заполните все поля!" | |
| ); | |
| } | |
| } | |
| } | |
| void LoginWindow::on_push_enter_clicked() { | |
| const QString login = ui->input_login->text(); | |
| const QString password = ui->input_password->text(); | |
| auto user = new User(); | |
| user->set_login(login.toStdString()); | |
| user->set_hashed_password(password.toStdString()); | |
| if (!login.isEmpty() && !password.isEmpty()) { | |
| if (login.size() > 50) { | |
| QMessageBox::warning( | |
| this, "Ошибка", | |
| "Длина логина не должна превышать пятидесяти символов" | |
| ); | |
| } else if (password.size() > 50) { | |
| QMessageBox::warning( | |
| this, "Ошибка", | |
| "Длина пароля не должна превышать пятидесяти символов" | |
| ); | |
| } else if (ClientImplementation::get_instance() | |
| .try_authenticate_user(user)) { | |
| QMessageBox::information( | |
| this, "Вход", "Вы успешно вошли! Добро пожаловать :)" | |
| ); | |
| QWidget *parent = this->parentWidget(); | |
| const QMainWindow *app_window = | |
| qobject_cast<QMainWindow *>(parent); | |
| if (QWidget *old = app_window->centralWidget()) { | |
| old->deleteLater(); | |
| } | |
| this->close(); | |
| } else { | |
| QMessageBox::warning( | |
| this, "Ошибка ввода данных", "Неверный логин или пароль!" | |
| ); | |
| } | |
| } else { | |
| QMessageBox::warning( | |
| this, "Ошибка ввода данных", "Пожалуйста, заполните все поля!" | |
| ); | |
| } | |
| } |
| ) { | ||
| 1 + 1; |
There was a problem hiding this comment.
The placeholder expression '1 + 1;' in the CreateNoteClientCall constructor indicates an incomplete implementation; replace it with the intended note creation logic.
| ) { | |
| 1 + 1; | |
| ) | |
| : responder_(stub->AsyncCreateNote(&context, request, cq)) { | |
| context.set_deadline( | |
| std::chrono::system_clock::now() + std::chrono::seconds(5) | |
| ); | |
| responder_->Finish(&reply_, &status, this); | |
| std::cout << "[CLIENT]: CREATE NOTE REQUEST SENT\n"; |
Fix server
…tracker into connect_main_window
Connect main window
No description provided.