changed: we should use SSL connection for such functions as:

adduser, login


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@766 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2011-09-14 09:56:00 +00:00
parent 39923d6617
commit f113e2ef31
7 changed files with 97 additions and 16 deletions

View File

@ -478,21 +478,21 @@ system.o: threadmanager.h ../templates/templates.h
system.o: ../templates/patterncacher.h ../templates/indexpatterns.h
system.o: ../templates/patterns.h ../templates/changepatterns.h ../core/cur.h
system.o: ../core/system.h ../core/sessionmanager.h ../core/htmlfilter.h
system.o: ../functions/functionbase.h ../core/request.h ../core/synchro.h
system.o: plugin.h pluginmsg.h sessionmanager.h sessioncontainer.h
system.o: ../functions/functions.h ../functions/functionbase.h
system.o: ../functions/functionparser.h ../functions/adduser.h
system.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
system.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
system.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
system.o: ../functions/last.h ../functions/login.h ../functions/logout.h
system.o: ../functions/ln.h ../functions/ls.h ../functions/mkdir.h
system.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
system.o: ../functions/passwd.h ../functions/priv.h ../functions/reload.h
system.o: ../functions/rm.h ../functions/sort.h ../functions/specialdefault.h
system.o: ../core/request.h ../core/synchro.h ../functions/functionparser.h
system.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
system.o: ../functions/privchanger.h ../functions/chown.h
system.o: ../functions/ckeditor.h ../functions/cp.h ../functions/default.h
system.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
system.o: ../functions/login.h ../functions/logout.h ../functions/ln.h
system.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
system.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
system.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
system.o: ../functions/sort.h ../functions/specialdefault.h
system.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
system.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
system.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
system.o: plugin.h pluginmsg.h sessionmanager.h sessioncontainer.h
textstream.o: textstream.h misc.h item.h requesttypes.h
threadmanager.o: threadmanager.h basethread.h synchro.h log.h textstream.h
threadmanager.o: logmanipulators.h slog.h cur.h request.h requesttypes.h

View File

@ -60,6 +60,7 @@ App::App()
system.SetCur(&cur);
system.SetDb(&db);
system.SetSynchro(&synchro);
system.SetFunctions(&functions);
templates.SetConfig(&config);
templates.SetCur(&cur);
@ -199,6 +200,22 @@ return true;
}
bool App::ShouldChangeToSSL()
{
if( !config.use_ssl || cur.request->using_ssl )
return false;
if( cur.request->function == &functions.fun_login ||
cur.request->function == &functions.fun_adduser )
return true;
if( config.use_ssl_only_for_logged_users && !cur.session->puser )
return false;
return true;
}
void App::ProcessRequestThrow()
{
ReadRequest();
@ -218,15 +235,15 @@ void App::ProcessRequestThrow()
}
plugin.Call(WINIX_SESSION_CHANGED);
functions.Parse(); // parsing directories,files,functions and parameters
if( (config.use_ssl && (!config.use_ssl_only_for_logged_users || cur.session->puser)) && !cur.request->using_ssl )
if( ShouldChangeToSSL() )
{
BaseUrlRedirect(303);
log << log3 << "App: BaseUrlRedirect from: " << cur.request->env_http_host << " to SSL connection" << logend;
log << log3 << "App: this operation should be used in SSL connection" << logend;
}
else
{
functions.Parse(); // parsing directories,files,functions and parameters
cur.mount = system.mounts.CalcCurMount();
if( system.mounts.pmount->type != system.mounts.MountTypeStatic() )

View File

@ -126,6 +126,7 @@ private:
void ProcessRequest();
void BaseUrlRedirect(int code);
bool BaseUrlRedirect();
bool ShouldChangeToSSL();
void MakePage();
void Make();
void SaveSessionsIfNeeded(); // !! wywalic do menagera sesji??

View File

@ -11,7 +11,7 @@
#include "misc.h"
#include "error.h"
#include "templates/templates.h"
#include "functions/functionbase.h"
#include "functions/functions.h"
#include "plugin.h"
@ -40,6 +40,11 @@ void System::SetSynchro(Synchro * psynchro)
}
void System::SetFunctions(Functions * pfunctions)
{
functions = pfunctions;
}
void System::Init()
@ -92,7 +97,10 @@ bool ssl = false;
if( can_use_ssl )
{
if( !config->use_ssl_only_for_logged_users || cur->session->puser )
if( !config->use_ssl_only_for_logged_users ||
cur->session->puser ||
cur->request->function == &functions->fun_login ||
cur->request->function == &functions->fun_adduser)
{
str += config->url_ssl_proto;
ssl = true;

View File

@ -27,6 +27,7 @@
#include "notify/notify.h"
class Functions;
// file system
@ -71,6 +72,7 @@ public:
void SetConfig(Config * pconfig);
void SetDb(Db * pdb);
void SetSynchro(Synchro * psynchro);
void SetFunctions(Functions * pfunctions);
void Init();
void AddParams(const ParamTab & param_tab, std::wstring & str, bool clear_str = true);
@ -142,6 +144,7 @@ private:
Db * db;
Config * config;
Synchro * synchro;
Functions * functions;
Item item_temp;
std::wstring link_to_temp, name_temp;

View File

@ -44,6 +44,7 @@ blockquote:before, blockquote:after {
content: "";
}
blockquote {
margin-left: 40px;
margin-right: 40px;
@ -67,6 +68,55 @@ strong {
font-weight: bold;
}
ul > li {
list-style-type: bullet;
margin-left: 2em;
padding: 0.4em 0 0.4em 15px;
}
ol > li {
list-style-type: decimal;
margin-left: 3em;
padding: 0.4em 0 0.4em 5px;
}
* html ul li {
list-style-type: bullet;
margin-left: 2em;
padding: 0.4em 0 0.4em 15px;
}
* html ol li {
list-style-type: decimal;
margin-left: 3em;
padding: 0.4em 0 0.4em 5px;
}
span.strikethrough {
text-decoration: line-through;
}
span.underline {
text-decoration: underline;
}
table {
margin-left: 3em;
}
table th {
font-weight: bold;
padding-right: 2em;
}
table td {
padding-right: 2em;
}
/* */
p.withnext {

View File

@ -69,10 +69,12 @@ font-weight: bold;
ul li {
list-style-type: bullet;
margin-left: 2em;
}
ol li {
list-style-type: decimal;
margin-left: 2em;
}
/* ---------------------- index template -------------------------- */