Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Alto
/
rkn
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 3bb0314f
authored
2021-06-02 20:53:58 +0300
by
Скуратович Александр
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
проверка авторизации
1 parent
b2d03962
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
71 deletions
assets/AppAsset.php
config/web.php
controllers/SiteController.php
modules/admin/Module.php
assets/AppAsset.php
View file @
3bb0314
...
...
@@ -34,7 +34,7 @@ class AppAsset extends AssetBundle
"/css/styles.css"
,
];
public
$js
=
[
'/app.js'
,
//
'/app.js',
// "js/vit-gallery.js",
// "js/jquery.countTo.js",
// "js/jquery.appear.min.js",
...
...
config/web.php
View file @
3bb0314
...
...
@@ -61,6 +61,7 @@ $config = [
'user'
=>
[
'identityClass'
=>
'app\models\User'
,
'enableAutoLogin'
=>
true
,
'loginUrl'
=>
[
'/auth/login'
],
],
'errorHandler'
=>
[
'errorAction'
=>
'site/error'
,
...
...
controllers/SiteController.php
View file @
3bb0314
...
...
@@ -22,15 +22,16 @@ class SiteController extends Controller
return
[
'access'
=>
[
'class'
=>
AccessControl
::
className
(),
'only'
=>
[
'logout'
],
'rules'
=>
[
[
'actions'
=>
[
'logout'
],
'actions'
=>
[
'
index'
,
'
logout'
],
'allow'
=>
true
,
'roles'
=>
[
'@'
],
],
],
],
'verbs'
=>
[
'class'
=>
VerbFilter
::
className
(),
'actions'
=>
[
...
...
@@ -69,72 +70,4 @@ class SiteController extends Controller
return
$this
->
render
(
'index'
);
}
/**
* Login action.
*
* @return Response|string
*/
public
function
actionLogin
()
{
if
(
!
Yii
::
$app
->
user
->
isGuest
)
{
return
$this
->
goHome
();
}
$model
=
new
LoginForm
();
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
login
())
{
return
$this
->
goBack
();
}
$model
->
password
=
''
;
return
$this
->
render
(
'login'
,
[
'model'
=>
$model
,
]);
}
/**
* Logout action.
*
* @return Response
*/
public
function
actionLogout
()
{
Yii
::
$app
->
user
->
logout
();
return
$this
->
goHome
();
}
/**
* Displays contact page.
*
* @return Response|string
*/
public
function
actionContact
()
{
$model
=
new
ContactForm
();
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
contact
(
Yii
::
$app
->
params
[
'adminEmail'
]))
{
Yii
::
$app
->
session
->
setFlash
(
'contactFormSubmitted'
);
return
$this
->
refresh
();
}
return
$this
->
render
(
'contact'
,
[
'model'
=>
$model
,
]);
}
/**
* Displays about page.
*
* @return string
*/
public
function
actionAbout
()
{
return
$this
->
render
(
'about'
);
}
public
function
actionError
()
{
$exception
=
Yii
::
$app
->
errorHandler
->
exception
;
if
(
$exception
!==
null
)
{
return
$this
->
render
(
'error'
,
[
'exception'
=>
$exception
]);
}
}
}
modules/admin/Module.php
View file @
3bb0314
...
...
@@ -2,11 +2,33 @@
namespace
app\modules\admin
;
use
yii\filters\AccessControl
;
use
yii\filters\VerbFilter
;
/**
* admin module definition class
*/
class
Module
extends
\yii\base\Module
{
/**
* {@inheritdoc}
*/
public
function
behaviors
()
{
return
[
'access'
=>
[
'class'
=>
AccessControl
::
className
(),
'rules'
=>
[
[
'allow'
=>
true
,
'roles'
=>
[
'@'
],
],
],
],
];
}
/**
* {@inheritdoc}
*/
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment