mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
Moved the register success and login success responses to 2 new virtual methods.
This commit is contained in:
parent
4aa9a28ed5
commit
f883b4d678
@ -71,11 +71,7 @@ void UserController::handle_login_request_default(Request *request) {
|
||||
|
||||
request->add_cookie(c);
|
||||
|
||||
//todo implement redirect!
|
||||
|
||||
request->body += "Login Success!<br>";
|
||||
|
||||
request->compile_and_send_body();
|
||||
render_login_success(request);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -177,6 +173,15 @@ void UserController::handle_register_request_default(Request *request) {
|
||||
UserModel::get_singleton()->create_password(user, data.pass_val);
|
||||
UserModel::get_singleton()->save_user(user);
|
||||
|
||||
render_register_success(request);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
render_register_request_default(request, &data);
|
||||
}
|
||||
|
||||
void UserController::render_register_success(Request *request) {
|
||||
HTMLBuilder b;
|
||||
|
||||
b.div()->cls("success");
|
||||
@ -192,11 +197,6 @@ void UserController::handle_register_request_default(Request *request) {
|
||||
request->body += b.result;
|
||||
|
||||
request->compile_and_send_body();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
render_register_request_default(request, &data);
|
||||
}
|
||||
|
||||
void UserController::render_register_request_default(Request *request, RegisterRequestData *data) {
|
||||
@ -262,6 +262,13 @@ void UserController::render_already_logged_in_error(Request *request) {
|
||||
request->compile_and_send_body();
|
||||
}
|
||||
|
||||
void UserController::render_login_success(Request *request) {
|
||||
request->body = "Login Success!<br>";
|
||||
|
||||
//request->compile_and_send_body();
|
||||
request->send_redirect("/user/settings");
|
||||
}
|
||||
|
||||
void UserController::handle_request(Ref<User> &user, Request *request) {
|
||||
const std::string &segment = request->get_current_path_segment();
|
||||
|
||||
|
@ -34,8 +34,10 @@ public:
|
||||
|
||||
virtual void handle_register_request_default(Request *request);
|
||||
virtual void render_register_request_default(Request *request, RegisterRequestData *data);
|
||||
virtual void render_register_success(Request *request);
|
||||
|
||||
virtual void render_already_logged_in_error(Request *request);
|
||||
virtual void render_login_success(Request *request);
|
||||
|
||||
virtual void handle_request(Ref<User> &user, Request *request);
|
||||
virtual void handle_main_page_request(Ref<User> &user, Request *request);
|
||||
|
Loading…
Reference in New Issue
Block a user