mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-30 21:09:19 +01:00
Remove the middleware from the user controller file.
This commit is contained in:
parent
30e3fd8faf
commit
fa768d2474
@ -793,28 +793,3 @@ FormValidator *UserController::_profile_validator = nullptr;
|
|||||||
|
|
||||||
String UserController::_path = "./";
|
String UserController::_path = "./";
|
||||||
String UserController::_table_name = "users";
|
String UserController::_table_name = "users";
|
||||||
|
|
||||||
// returnring true means handled, false means continue
|
|
||||||
bool UserSessionSetupMiddleware::on_before_handle_request_main(Request *request) {
|
|
||||||
if (request->session.is_valid()) {
|
|
||||||
int user_id = request->session->get_int("user_id");
|
|
||||||
|
|
||||||
if (user_id != 0) {
|
|
||||||
Ref<User> u = UserController::get_singleton()->db_get_user(user_id);
|
|
||||||
|
|
||||||
if (u.is_valid()) {
|
|
||||||
request->reference_data["user"] = u;
|
|
||||||
} else {
|
|
||||||
// log
|
|
||||||
request->session->remove("user_id");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserSessionSetupMiddleware::UserSessionSetupMiddleware() {
|
|
||||||
}
|
|
||||||
UserSessionSetupMiddleware::~UserSessionSetupMiddleware() {
|
|
||||||
}
|
|
||||||
|
@ -122,16 +122,4 @@ protected:
|
|||||||
static String _table_name;
|
static String _table_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
// just session setup
|
|
||||||
class UserSessionSetupMiddleware : public Middleware {
|
|
||||||
RCPP_OBJECT(UserSessionSetupMiddleware, Middleware);
|
|
||||||
|
|
||||||
public:
|
|
||||||
//returnring true means handled, false means continue
|
|
||||||
bool on_before_handle_request_main(Request *request);
|
|
||||||
|
|
||||||
UserSessionSetupMiddleware();
|
|
||||||
~UserSessionSetupMiddleware();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user