Zaktualizuj rozmiary plików w konfiguracji oraz popraw logikę logowania użytkowników
This commit is contained in:
@@ -5,15 +5,15 @@ class Site
|
||||
public static function route()
|
||||
{
|
||||
global $user;
|
||||
|
||||
|
||||
$class = '\controls\\';
|
||||
|
||||
|
||||
$results = explode( '_', \S::get( 'module' ) );
|
||||
if ( is_array( $results ) ) foreach ( $results as $row )
|
||||
$class .= ucfirst( $row );
|
||||
|
||||
|
||||
$action = \S::get( 'action' );
|
||||
|
||||
|
||||
if ( class_exists( $class ) and method_exists( new $class, $action ) )
|
||||
{
|
||||
if ( \controls\Users::permissions( $user['id'], \S::get( 'module' ) ) )
|
||||
|
||||
@@ -82,10 +82,7 @@ class Users
|
||||
|
||||
public static function login()
|
||||
{
|
||||
if ( $user = \factory\Users::login(
|
||||
\S::get( 'email' ),
|
||||
md5( \S::get( 'password' ) )
|
||||
) )
|
||||
if ( $user = \factory\Users::login( \S::get( 'email' ), md5( \S::get( 'password' ) ) ) )
|
||||
{
|
||||
// zapamiętaj logowanie
|
||||
if ( \S::get( 'remember' ) )
|
||||
@@ -98,6 +95,12 @@ class Users
|
||||
|
||||
setcookie( $cookie_name, $value, strtotime( "+1 year" ), "/", $domain );
|
||||
}
|
||||
else
|
||||
{
|
||||
$domain = preg_replace( '#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME'] );
|
||||
$cookie_name = str_replace( '.', '-', $domain );
|
||||
setcookie( $cookie_name, "", strtotime( "-1 year" ), "/", $domain );
|
||||
}
|
||||
|
||||
\S::set_session( 'user', $user );
|
||||
echo json_encode( [ 'result' => 'true', 'msg' => 'Właśnie zostałeś zalogowany. Za chwilę nastąpi przekierowanie.', 'default_project' => $user[ 'default_project' ] ] );
|
||||
|
||||
Reference in New Issue
Block a user