Merge branch 'master' of github.com:gebhardtdasense/system

Conflicts:
	security/Security.php
This commit is contained in:
Ulf Gebhardt 2013-06-26 15:06:29 +02:00
commit 356b059347
6 changed files with 11 additions and 8 deletions

View File

@ -63,7 +63,7 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
<h3>Truncate table system.sys_log</h3> <h3>Truncate table system.sys_log</h3>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>This action will delete all error messages from databse. <br /> <p>This action will delete all error messages from database. <br />
Are you sure?</p> Are you sure?</p>
<span id="info_box" /> <span id="info_box" />
</div> </div>

View File

@ -3,8 +3,8 @@ function init__SYSTEM_SAI_saimod_sys_login() {
$("#login_form input").not("[type=submit]").jqBootstrapValidation({ $("#login_form input").not("[type=submit]").jqBootstrapValidation({
preventSubmit: true, preventSubmit: true,
submitError: function($form, event, errors) {}, submitError: function($form, event, errors) {},
submitSuccess: function($form, event){ submitSuccess: function($form, event){
$.get('./api.php?call=account&action=login&username='+$('#bt_login_user').val()+'&password_sha='+$.sha1($('#bt_login_password').val())+'&password_md5='+hex_md5($('#bt_login_password').val()), function (data) { $.get('./api.php?call=account&action=login&username='+$('#bt_login_user').val()+'&password_sha='+$.sha1($('#bt_login_password').val())+'&password_md5='+$.md5($('#bt_login_password').val()), function (data) {
if(data == 1){ if(data == 1){
$('.help-block').html("Login successfull.</br>"); $('.help-block').html("Login successfull.</br>");
location.reload(true); location.reload(true);

View File

@ -32,7 +32,7 @@ class saimod_sys_login extends \SYSTEM\SAI\SaiModule {
public static function src_js(){return \SYSTEM\LOG\JsonResult::toString( public static function src_js(){return \SYSTEM\LOG\JsonResult::toString(
array( \SYSTEM\WEBPATH(new \PPAGE(),'default_page/js/jqBootstrapValidation.js'), array( \SYSTEM\WEBPATH(new \PPAGE(),'default_page/js/jqBootstrapValidation.js'),
\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_login/sai_sys_login_submit.js'), \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_login/sai_sys_login_submit.js'),
\SYSTEM\WEBPATH(new \PPAGE(),'default_page/js/crypto/md5.js'), \SYSTEM\WEBPATH(new \PPAGE(),'default_page/js/crypto/jquery.md5.js'),
\SYSTEM\WEBPATH(new \PPAGE(),'default_page/js/crypto/jquery.sha1.js') \SYSTEM\WEBPATH(new \PPAGE(),'default_page/js/crypto/jquery.sha1.js')
));} ));}
} }

View File

@ -112,7 +112,8 @@ class Security {
time(), time(),
getenv('REMOTE_ADDR'), getenv('REMOTE_ADDR'),
0, 0,
NULL); NULL,
$row[\SYSTEM\DBD\UserTable::FIELD_LOCALE]);
if(isset($locale)){ if(isset($locale)){
\SYSTEM\locale::set($locale);} \SYSTEM\locale::set($locale);}
@ -224,7 +225,7 @@ class Security {
$con = new \SYSTEM\DB\Connection($dbinfo); $con = new \SYSTEM\DB\Connection($dbinfo);
$res = $con->prepare( 'updateUserLocaleStmt', $res = $con->prepare( 'updateUserLocaleStmt',
'UPDATE '.\SYSTEM\DBD\UserTable::NAME.' SET '.\SYSTEM\DBD\UserTable::FIELD_LOCALE.' = $1 '. 'UPDATE '.(\SYSTEM\system::isSystemDbInfoPG() ? \SYSTEM\DBD\UserTable::NAME_PG : \SYSTEM\DBD\UserTable::NAME_MYS).' SET '.\SYSTEM\DBD\UserTable::FIELD_LOCALE.' = $1 '.
'WHERE '.\SYSTEM\DBD\UserTable::FIELD_ID.' = $2'.' RETURNING '.\SYSTEM\DBD\UserTable::FIELD_LOCALE.';', 'WHERE '.\SYSTEM\DBD\UserTable::FIELD_ID.' = $2'.' RETURNING '.\SYSTEM\DBD\UserTable::FIELD_LOCALE.';',
array($lang, $user->id)); array($lang, $user->id));
if(!$res->next()){ if(!$res->next()){

View File

@ -12,8 +12,9 @@ class User {
public $lastLoginIP = NULL; public $lastLoginIP = NULL;
public $passwordWrongCount = NULL; public $passwordWrongCount = NULL;
public $rights = NULL; public $rights = NULL;
public $locale = NULL;
public function __construct($id, $username, $email, $creationDate, $lastLoginDate, $lastLoginIP, $passwordWrongCount, $rights){ public function __construct($id, $username, $email, $creationDate, $lastLoginDate, $lastLoginIP, $passwordWrongCount, $rights, $locale){
$this->id = $id; $this->id = $id;
$this->username = $username; $this->username = $username;
$this->email = $email; $this->email = $email;
@ -22,5 +23,6 @@ class User {
$this->lastLoginIP = $lastLoginIP; $this->lastLoginIP = $lastLoginIP;
$this->passwordWrongCount = $passwordWrongCount; $this->passwordWrongCount = $passwordWrongCount;
$this->rights = $rights; $this->rights = $rights;
$this->locale = $locale;
} }
} }

View File

@ -15,7 +15,7 @@ class locale {
\SYSTEM\SECURITY\Security::save(self::SESSION_KEY, $lang); \SYSTEM\SECURITY\Security::save(self::SESSION_KEY, $lang);
if(\SYSTEM\SECURITY\Security::isLoggedIn()){ if(\SYSTEM\SECURITY\Security::isLoggedIn()){
\SYSTEM\SECURITY\Security::_db_setLocale(new \SYSTEM\DBD\systemPostgres(), $lang);} //TODO: connection def move somewhere? \SYSTEM\SECURITY\Security::_db_setLocale(\SYSTEM\system::getSystemDBInfo(), $lang);} //TODO: connection def move somewhere?
return true; return true;
} }