mirror of
https://github.com/Relintai/mourne_rcpp_fw.git
synced 2025-01-13 07:41:12 +01:00
Small improvements.
This commit is contained in:
parent
9aa2e64199
commit
deb3a6dd08
@ -17,15 +17,10 @@
|
||||
#include "modules/users/user.h"
|
||||
#include "modules/users/user_controller.h"
|
||||
|
||||
bool MourneApplication::ensure_login(Request *request) {
|
||||
bool MourneApplication::is_logged_in(Request *request) {
|
||||
Ref<User> u = request->reference_data["user"];
|
||||
|
||||
if (!u.is_valid()) {
|
||||
request->send_redirect("/user/login");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return u.is_valid();
|
||||
}
|
||||
|
||||
void MourneApplication::index(Object *instance, Request *request) {
|
||||
@ -51,7 +46,6 @@ void MourneApplication::index(Object *instance, Request *request) {
|
||||
<?php endif; ?>
|
||||
*/
|
||||
|
||||
|
||||
//dynamic_cast<ListPage *>(instance)->index(request);
|
||||
request->body += "test";
|
||||
request->compile_and_send_body();
|
||||
@ -212,7 +206,9 @@ void MourneApplication::village_page_func(Object *instance, Request *request) {
|
||||
}
|
||||
|
||||
void MourneApplication::user_page_func(Object *instance, Request *request) {
|
||||
if (is_logged_in(request)) {
|
||||
add_menu(request, MENUENTRY_SETTINGS);
|
||||
}
|
||||
|
||||
UserController::get_singleton()->handle_request_default(request);
|
||||
}
|
||||
|
@ -11,7 +11,8 @@
|
||||
#include "modules/paged_list/paged_list.h"
|
||||
|
||||
#define ENSURE_LOGIN(request) \
|
||||
if (!ensure_login(request)) { \
|
||||
if (!is_logged_in(request)) { \
|
||||
request->send_redirect("/user/login"); \
|
||||
return; \
|
||||
}
|
||||
|
||||
@ -34,7 +35,7 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
static bool ensure_login(Request *request);
|
||||
static bool is_logged_in(Request *request);
|
||||
|
||||
static void index(Object *instance, Request *request);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user