mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
Work on handle_login_request_default.
This commit is contained in:
parent
45af98ab18
commit
a4c28867f2
@ -1,9 +1,11 @@
|
|||||||
#include "user.h"
|
#include "user.h"
|
||||||
|
|
||||||
|
#include "core/html/html_builder.h"
|
||||||
#include "core/http/http_session.h"
|
#include "core/http/http_session.h"
|
||||||
#include "core/http/request.h"
|
#include "core/http/request.h"
|
||||||
#include "core/http/session_manager.h"
|
#include "core/http/session_manager.h"
|
||||||
#include "core/html/html_builder.h"
|
#include "core/utils.h"
|
||||||
|
#include "user_manager.h"
|
||||||
|
|
||||||
void User::save() {
|
void User::save() {
|
||||||
}
|
}
|
||||||
@ -102,14 +104,28 @@ void User::handle_login_request_default(Request *request) {
|
|||||||
std::string pass_val = "";
|
std::string pass_val = "";
|
||||||
|
|
||||||
if (request->get_method() == HTTP_METHOD_POST) {
|
if (request->get_method() == HTTP_METHOD_POST) {
|
||||||
request->body += "handle_login_request_default POST<br>";
|
uname_val = request->get_parameter("username");
|
||||||
|
pass_val = request->get_parameter("password");
|
||||||
|
|
||||||
|
User *user = UserManager::get_singleton()->get_user(uname_val);
|
||||||
|
|
||||||
|
if (user) {
|
||||||
|
//todo
|
||||||
|
} else {
|
||||||
|
error_str = "Invalid username or password!";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HTMLBuilder b;
|
HTMLBuilder b;
|
||||||
|
|
||||||
|
if (error_str.size() != 0) {
|
||||||
|
b.div()->cls("error");
|
||||||
|
|
||||||
|
b.w(error_str);
|
||||||
|
|
||||||
|
b.cdiv();
|
||||||
|
}
|
||||||
|
|
||||||
b.div()->cls("login");
|
b.div()->cls("login");
|
||||||
|
|
||||||
//todo href path helper
|
//todo href path helper
|
||||||
@ -129,7 +145,6 @@ void User::handle_login_request_default(Request *request) {
|
|||||||
b.cform();
|
b.cform();
|
||||||
|
|
||||||
b.cdiv();
|
b.cdiv();
|
||||||
|
|
||||||
|
|
||||||
request->body += b.result;
|
request->body += b.result;
|
||||||
|
|
||||||
@ -144,7 +159,7 @@ void User::handle_register_request_default(Request *request) {
|
|||||||
|
|
||||||
void User::handle_request(Request *request) {
|
void User::handle_request(Request *request) {
|
||||||
const std::string &segment = request->get_current_path_segment();
|
const std::string &segment = request->get_current_path_segment();
|
||||||
|
|
||||||
if (segment == "") {
|
if (segment == "") {
|
||||||
handle_main_page_request(request);
|
handle_main_page_request(request);
|
||||||
} else if (segment == "settings") {
|
} else if (segment == "settings") {
|
||||||
|
Loading…
Reference in New Issue
Block a user