diff --git a/modules/users/doc_classes/UserWebPage.xml b/modules/users/doc_classes/UserWebPage.xml
index a6f586e09..2a6b64dcd 100644
--- a/modules/users/doc_classes/UserWebPage.xml
+++ b/modules/users/doc_classes/UserWebPage.xml
@@ -19,6 +19,15 @@
+
+
+
+
+
+ Implementing this method will make the system call it instead of the normal built in html rendering methods on the engine side.
+ This is when you want to only customize the rendered html. If you need to change backend logic, look at the other available virtuals.
+
+
diff --git a/modules/users/web/web_nodes/user_login_web_page.cpp b/modules/users/web/web_nodes/user_login_web_page.cpp
index 6db611ef0..9b5cb5912 100644
--- a/modules/users/web/web_nodes/user_login_web_page.cpp
+++ b/modules/users/web/web_nodes/user_login_web_page.cpp
@@ -54,7 +54,16 @@ void UserLoginWebPage::_render_index(Ref request) {
emit_signal("user_logged_in", request, user);
- render_login_success(request);
+ if (has_method("_render_user_page")) {
+ Dictionary d;
+
+ d["type"] = "render_login_success";
+ d["user"] = user;
+
+ call("_render_user_page", request, d);
+ } else {
+ render_login_success(request);
+ }
return;
}
@@ -63,7 +72,18 @@ void UserLoginWebPage::_render_index(Ref request) {
}
}
- render_login_request_default(request, &data);
+ if (has_method("_render_user_page")) {
+ Dictionary d;
+
+ d["type"] = "render_login_request_default";
+ d["error_str"] = data.error_str;
+ d["uname_val"] = data.uname_val;
+ d["pass_val"] = data.pass_val;
+
+ call("_render_user_page", request, d);
+ } else {
+ render_login_request_default(request, &data);
+ }
}
void UserLoginWebPage::render_login_request_default(Ref request, LoginRequestData *data) {
diff --git a/modules/users/web/web_nodes/user_logout_web_page.cpp b/modules/users/web/web_nodes/user_logout_web_page.cpp
index f38c733a2..5c19851fc 100644
--- a/modules/users/web/web_nodes/user_logout_web_page.cpp
+++ b/modules/users/web/web_nodes/user_logout_web_page.cpp
@@ -29,11 +29,19 @@ void UserLogoutWebPage::_render_index(Ref request) {
emit_signal("user_logged_out", request, user);
- HTMLBuilder b;
- b.w("Logout successful!");
- request->body += b.result;
+ if (has_method("_render_user_page")) {
+ Dictionary d;
- request->compile_and_send_body();
+ d["user"] = user;
+
+ call("_render_user_page", request, d);
+ } else {
+ HTMLBuilder b;
+ b.w("Logout successful!");
+ request->body += b.result;
+
+ request->compile_and_send_body();
+ }
}
UserLogoutWebPage::UserLogoutWebPage() {
diff --git a/modules/users/web/web_nodes/user_register_web_page.cpp b/modules/users/web/web_nodes/user_register_web_page.cpp
index bc006bea1..a9d224181 100644
--- a/modules/users/web/web_nodes/user_register_web_page.cpp
+++ b/modules/users/web/web_nodes/user_register_web_page.cpp
@@ -63,12 +63,35 @@ void UserRegisterWebPage::_render_index(Ref request) {
emit_signal("user_registered", request, user);
- render_register_success(request);
+ if (has_method("_render_user_page")) {
+ Dictionary d;
+
+ d["type"] = "render_register_success";
+ d["user"] = user;
+
+ call("_render_user_page", request, d);
+ } else {
+ render_register_success(request);
+ }
+
return;
}
}
- render_register_request_default(request, &data);
+ if (has_method("_render_user_page")) {
+ Dictionary d;
+
+ d["type"] = "render_register_request_default";
+ d["error_str"] = data.error_str;
+ d["uname_val"] = data.uname_val;
+ d["email_val"] = data.email_val;
+ d["pass_val"] = data.pass_val;
+ d["pass_check_val"] = data.pass_check_val;
+
+ call("_render_user_page", request, d);
+ } else {
+ render_register_request_default(request, &data);
+ }
}
void UserRegisterWebPage::render_register_success(Ref request) {
diff --git a/modules/users/web/web_nodes/user_settings_web_page.cpp b/modules/users/web/web_nodes/user_settings_web_page.cpp
index e16ccc331..44c5130d9 100644
--- a/modules/users/web/web_nodes/user_settings_web_page.cpp
+++ b/modules/users/web/web_nodes/user_settings_web_page.cpp
@@ -84,7 +84,20 @@ void UserSettingsWebPage::_render_index(Ref request) {
}
}
- render_settings_request(user, request, &data);
+ if (has_method("_render_user_page")) {
+ Dictionary d;
+
+ d["user"] = user;
+ d["error_str"] = data.error_str;
+ d["uname_val"] = data.uname_val;
+ d["email_val"] = data.email_val;
+ d["pass_val"] = data.pass_val;
+ d["pass_check_val"] = data.pass_check_val;
+
+ call("_render_user_page", request, d);
+ } else {
+ render_settings_request(user, request, &data);
+ }
}
void UserSettingsWebPage::render_settings_request(Ref &user, Ref request, SettingsRequestData *data) {
diff --git a/modules/users/web/web_nodes/user_web_page.cpp b/modules/users/web/web_nodes/user_web_page.cpp
index 55f65ca93..6334cd9c1 100644
--- a/modules/users/web/web_nodes/user_web_page.cpp
+++ b/modules/users/web/web_nodes/user_web_page.cpp
@@ -137,6 +137,8 @@ UserWebPage::~UserWebPage() {
}
void UserWebPage::_bind_methods() {
+ BIND_VMETHOD(MethodInfo("_render_user_page", PropertyInfo(Variant::OBJECT, "request", PROPERTY_HINT_RESOURCE_TYPE, "WebServerRequest"), PropertyInfo(Variant::DICTIONARY, "data")));
+
ClassDB::bind_method(D_METHOD("get_logged_out_render_type"), &UserWebPage::get_logged_out_render_type);
ClassDB::bind_method(D_METHOD("set_logged_out_render_type", "val"), &UserWebPage::set_logged_out_render_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "logged_out_render_type", PROPERTY_HINT_ENUM, "Render,Redirect,Error"), "set_logged_out_render_type", "get_logged_out_render_type");