2010-08-10 18:12:50 +02:00
|
|
|
/*
|
|
|
|
* This file is a part of Winix
|
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
|
|
|
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "login.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace Fun
|
|
|
|
{
|
|
|
|
|
|
|
|
Login::Login()
|
|
|
|
{
|
2010-11-21 01:19:17 +01:00
|
|
|
fun.url = L"login";
|
2010-08-10 18:12:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Login::MakePost()
|
|
|
|
{
|
2011-01-23 15:15:30 +01:00
|
|
|
if( cur->session->id == 0 )
|
2011-01-21 17:16:52 +01:00
|
|
|
{
|
|
|
|
log << log1 << "Login: can't login in a temporary session (skipped)" << logend;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
const std::wstring & login = cur->request->PostVar(L"login");
|
|
|
|
const std::wstring & pass = cur->request->PostVar(L"password");
|
|
|
|
const std::wstring & remem = cur->request->PostVar(L"rememberme");
|
2010-08-10 18:12:50 +02:00
|
|
|
long user_id;
|
|
|
|
|
2010-08-12 21:10:12 +02:00
|
|
|
if( db->CheckUser(login, pass, user_id) )
|
|
|
|
system->users.LoginUser(user_id, !remem.empty());
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
// !! moze zglosic komunikat o nie poprawnym logowaniu
|
|
|
|
|
|
|
|
system->RedirectToLastItem();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace
|