Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskonsite-архив-перенесен
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Korolev
taskonsite-архив-перенесен
Commits
301af5eb
Commit
301af5eb
authored
May 12, 2016
by
Олег Гиммельшпах
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1191
parent
87a14e84
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
21 deletions
+31
-21
backend/controllers/SiteController.php
backend/controllers/SiteController.php
+4
-1
backend/views/site/error.php
backend/views/site/error.php
+2
-2
common/components/AdminController.php
common/components/AdminController.php
+2
-7
common/models/LoginForm.php
common/models/LoginForm.php
+17
-5
common/modules/users/controllers/UserAdminController.php
common/modules/users/controllers/UserAdminController.php
+5
-5
common/modules/users/models/User.php
common/modules/users/models/User.php
+1
-1
No files found.
backend/controllers/SiteController.php
View file @
301af5eb
...
...
@@ -49,7 +49,10 @@ class SiteController extends Controller
public
function
actionError
()
{
$this
->
layout
=
"clear"
;
return
$this
->
render
(
'error'
);
$exception
=
Yii
::
$app
->
errorHandler
->
exception
;
return
$this
->
render
(
'error'
,
[
'exception'
=>
$exception
]);
}
public
function
actionLogin
()
...
...
backend/views/site/error.php
View file @
301af5eb
...
...
@@ -17,9 +17,9 @@ use common\models\Settings;
<div
id=
"page-container"
class=
"fade"
>
<!-- begin error -->
<div
class=
"error"
>
<div
class=
"error-code m-b-10"
>
404
<i
class=
"fa fa-warning"
></i></div>
<div
class=
"error-code m-b-10"
>
<?=
(
$exception
?
$exception
->
statusCode
:
'404'
)
?>
<i
class=
"fa fa-warning"
></i></div>
<div
class=
"error-content"
>
<div
class=
"error-message"
>
Произошла какая-то ошибка
</div>
<div
class=
"error-message"
>
<?=
(
$exception
?
$exception
->
getMessage
()
:
'Произошла какая-то ошибка'
)
?>
</div>
<div
class=
"error-desc m-b-20"
>
Страница не существует или у вас нет прав для ее просмотра.
<br
/>
Проверьте введенный URL-адрес страницы или обратитесь в Службу технической поддержки для решения данного вопроса
...
...
common/components/AdminController.php
View file @
301af5eb
...
...
@@ -26,16 +26,11 @@ abstract class AdminController extends \common\components\BaseController
return
$this
->
redirect
(
'/site/login'
);
}
if
(
Yii
::
$app
->
user
->
identity
->
role
!=
User
::
ROLE_ADMIN
)
{
throw
new
NotSupportedException
(
'The requested page does not exist.'
);
}
$module
=
$this
->
getModuleName
();
if
(
$module
&&
!
Yii
::
$app
->
authManager
->
checkAccess
(
Yii
::
$app
->
user
->
id
,
$module
))
if
(
Yii
::
$app
->
user
->
identity
->
role
!=
User
::
ROLE_ADMIN
||
(
$module
&&
!
Yii
::
$app
->
authManager
->
checkAccess
(
Yii
::
$app
->
user
->
id
,
$module
)
))
{
throw
new
\
Exception
(
'There is no access to this page'
,
403
);
throw
new
\
yii\web\HttpException
(
403
,
'У Вас нет прав для просмотра этой страницы'
);
}
}
...
...
common/models/LoginForm.php
View file @
301af5eb
...
...
@@ -44,11 +44,18 @@ class LoginForm extends Model
*/
public
function
validatePassword
(
$attribute
,
$params
)
{
if
(
!
$this
->
hasErrors
())
{
if
(
!
$this
->
hasErrors
())
{
$user
=
$this
->
getUser
();
if
(
!
$user
||
!
$user
->
validatePassword
(
$this
->
password
))
{
if
(
!
$user
||
!
$user
->
validatePassword
(
$this
->
password
))
{
$this
->
addError
(
$attribute
,
'Неверно указан e-mail или пароль. Проверьте правильность ввода.'
);
}
elseif
(
$user
->
status
==
User
::
STATUS_BLOCKED
)
{
$this
->
addError
(
$attribute
,
'У Вас нет прав для просмотра данного раздела. Обратитесь к Администратору для изменения параметров авторизации.'
);
}
}
}
...
...
@@ -61,10 +68,15 @@ class LoginForm extends Model
{
$user
=
$this
->
getUser
();
$user
->
last_logon
=
time
();
$user
->
save
(
false
,
[
'last_logon'
]);
if
(
$user
)
{
$user
->
last_logon
=
time
();
$user
->
save
(
false
,
[
'last_logon'
]);
return
Yii
::
$app
->
user
->
login
(
$user
,
$this
->
rememberMe
?
3600
*
24
*
30
:
0
);
}
return
Yii
::
$app
->
user
->
login
(
$user
,
$this
->
rememberMe
?
3600
*
24
*
30
:
0
)
;
return
false
;
}
/**
...
...
common/modules/users/controllers/UserAdminController.php
View file @
301af5eb
...
...
@@ -183,13 +183,13 @@ class UserAdminController extends \common\components\AdminController
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
()))
{
if
(
$model
->
send_email
)
{
$model
->
sendPassword
();
}
if
(
$model
->
password
)
{
if
(
$model
->
send_email
)
{
$model
->
sendPassword
();
}
$model
->
password
=
$model
->
password_c
=
\Yii
::
$app
->
security
->
generatePasswordHash
(
$model
->
password
);
}
else
...
...
common/modules/users/models/User.php
View file @
301af5eb
...
...
@@ -286,7 +286,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
*/
public
static
function
findByUsername
(
$username
)
{
return
static
::
findOne
([
'email'
=>
$username
,
'status'
=>
self
::
STATUS_ACTIVE
]);
return
static
::
findOne
([
'email'
=>
$username
/*, 'status' => self::STATUS_ACTIVE*/
]);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment