pandemonium_engine/modules/users/web/web_nodes/user_controller.h

73 lines
2.1 KiB
C++
Raw Normal View History

#ifndef USER_CONTROLLER_H
#define USER_CONTROLLER_H
2022-07-22 12:09:00 +02:00
#include "core/reference.h"
#include "core/ustring.h"
#include "core/containers/vector.h"
2022-07-22 12:09:00 +02:00
#include "modules/web/http/web_node.h"
2022-07-22 12:09:00 +02:00
class WebServerRequest;
class FormValidator;
2022-07-22 12:09:00 +02:00
class User;
2022-07-07 21:53:28 +02:00
class UserController : public WebNode {
2022-07-22 12:09:00 +02:00
GDCLASS(UserController, WebNode);
public:
2022-07-22 12:09:00 +02:00
void _handle_request_main(Ref<WebServerRequest> request);
struct LoginRequestData {
String error_str;
String uname_val;
String pass_val;
};
2022-07-22 12:09:00 +02:00
virtual void handle_login_request_default(Ref<WebServerRequest> request);
virtual void render_login_request_default(Ref<WebServerRequest> request, LoginRequestData *data);
struct RegisterRequestData {
String error_str;
String uname_val;
String email_val;
String pass_val;
String pass_check_val;
};
2022-07-22 12:09:00 +02:00
virtual void handle_register_request_default(Ref<WebServerRequest> request);
virtual void render_register_request_default(Ref<WebServerRequest> request, RegisterRequestData *data);
virtual void render_register_success(Ref<WebServerRequest> request);
2022-07-22 12:09:00 +02:00
virtual void render_already_logged_in_error(Ref<WebServerRequest> request);
virtual void render_login_success(Ref<WebServerRequest> request);
2022-07-22 12:09:00 +02:00
virtual void handle_request(Ref<User> &user, Ref<WebServerRequest> request);
virtual void handle_main_page_request(Ref<User> &user, Ref<WebServerRequest> request);
struct SettingsRequestData {
String error_str;
String uname_val;
String email_val;
String pass_val;
String pass_check_val;
};
2022-07-22 12:09:00 +02:00
virtual void handle_settings_request(Ref<User> &user, Ref<WebServerRequest> request);
virtual void render_settings_request(Ref<User> &user, Ref<WebServerRequest> request, SettingsRequestData *data);
2022-07-22 12:09:00 +02:00
virtual void handle_password_reset_request(Ref<User> &user, Ref<WebServerRequest> request);
virtual void handle_logout_request(Ref<User> &user, Ref<WebServerRequest> request);
virtual void handle_delete_request(Ref<User> &user, Ref<WebServerRequest> request);
UserController();
~UserController();
protected:
2022-07-22 12:09:00 +02:00
Ref<FormValidator> _login_validator;
Ref<FormValidator> _registration_validator;
Ref<FormValidator> _profile_validator;
};
2022-07-07 00:18:37 +02:00
#endif