Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
dfb38954
Commit
dfb38954
authored
Oct 18, 2013
by
Yakir Sitbon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert to short syntax (array)
parent
153f6971
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
48 deletions
+48
-48
SiteController.php
apps/basic/controllers/SiteController.php
+30
-30
ContactForm.php
apps/basic/models/ContactForm.php
+7
-7
LoginForm.php
apps/basic/models/LoginForm.php
+5
-5
User.php
apps/basic/models/User.php
+6
-6
No files found.
apps/basic/controllers/SiteController.php
View file @
dfb38954
...
...
@@ -13,43 +13,43 @@ class SiteController extends Controller
{
public
function
behaviors
()
{
return
array
(
'access'
=>
array
(
return
[
'access'
=>
[
'class'
=>
AccessControl
::
className
(),
'only'
=>
array
(
'login'
,
'logout'
)
,
'rules'
=>
array
(
array
(
'actions'
=>
array
(
'login'
)
,
'only'
=>
[
'login'
,
'logout'
]
,
'rules'
=>
[
[
'actions'
=>
[
'login'
]
,
'allow'
=>
true
,
'roles'
=>
array
(
'?'
)
,
)
,
array
(
'actions'
=>
array
(
'logout'
)
,
'roles'
=>
[
'?'
]
,
]
,
[
'actions'
=>
[
'logout'
]
,
'allow'
=>
true
,
'roles'
=>
array
(
'@'
)
,
)
,
)
,
)
,
'verbs'
=>
array
(
'roles'
=>
[
'@'
]
,
]
,
]
,
]
,
'verbs'
=>
[
'class'
=>
VerbFilter
::
className
(),
'actions'
=>
array
(
'logout'
=>
array
(
'post'
)
,
)
,
)
,
)
;
'actions'
=>
[
'logout'
=>
[
'post'
]
,
]
,
]
,
]
;
}
public
function
actions
()
{
return
array
(
'error'
=>
array
(
return
[
'error'
=>
[
'class'
=>
'yii\web\ErrorAction'
,
)
,
'captcha'
=>
array
(
]
,
'captcha'
=>
[
'class'
=>
'yii\captcha\CaptchaAction'
,
'fixedVerifyCode'
=>
YII_ENV_TEST
?
'testme'
:
null
,
)
,
)
;
]
,
]
;
}
public
function
actionIndex
()
...
...
@@ -63,9 +63,9 @@ class SiteController extends Controller
if
(
$model
->
load
(
$_POST
)
&&
$model
->
login
())
{
return
$this
->
goBack
();
}
else
{
return
$this
->
render
(
'login'
,
array
(
return
$this
->
render
(
'login'
,
[
'model'
=>
$model
,
)
);
]
);
}
}
...
...
@@ -82,9 +82,9 @@ class SiteController extends Controller
Yii
::
$app
->
session
->
setFlash
(
'contactFormSubmitted'
);
return
$this
->
refresh
();
}
else
{
return
$this
->
render
(
'contact'
,
array
(
return
$this
->
render
(
'contact'
,
[
'model'
=>
$model
,
)
);
]
);
}
}
...
...
apps/basic/models/ContactForm.php
View file @
dfb38954
...
...
@@ -20,14 +20,14 @@ class ContactForm extends Model
*/
public
function
rules
()
{
return
array
(
return
[
// name, email, subject and body are required
array
(
'name, email, subject, body'
,
'required'
)
,
[
'name, email, subject, body'
,
'required'
]
,
// email has to be a valid email address
array
(
'email'
,
'email'
)
,
[
'email'
,
'email'
]
,
// verifyCode needs to be entered correctly
array
(
'verifyCode'
,
'captcha'
)
,
)
;
[
'verifyCode'
,
'captcha'
]
,
]
;
}
/**
...
...
@@ -35,9 +35,9 @@ class ContactForm extends Model
*/
public
function
attributeLabels
()
{
return
array
(
return
[
'verifyCode'
=>
'Verification Code'
,
)
;
]
;
}
/**
...
...
apps/basic/models/LoginForm.php
View file @
dfb38954
...
...
@@ -19,14 +19,14 @@ class LoginForm extends Model
*/
public
function
rules
()
{
return
array
(
return
[
// username and password are both required
array
(
'username, password'
,
'required'
)
,
[
'username, password'
,
'required'
]
,
// password is validated by validatePassword()
array
(
'password'
,
'validatePassword'
)
,
[
'password'
,
'validatePassword'
]
,
// rememberMe must be a boolean value
array
(
'rememberMe'
,
'boolean'
)
,
)
;
[
'rememberMe'
,
'boolean'
]
,
]
;
}
/**
...
...
apps/basic/models/User.php
View file @
dfb38954
...
...
@@ -9,20 +9,20 @@ class User extends \yii\base\Object implements \yii\web\IdentityInterface
public
$password
;
public
$authKey
;
private
static
$users
=
array
(
'100'
=>
array
(
private
static
$users
=
[
'100'
=>
[
'id'
=>
'100'
,
'username'
=>
'admin'
,
'password'
=>
'admin'
,
'authKey'
=>
'test100key'
,
)
,
'101'
=>
array
(
]
,
'101'
=>
[
'id'
=>
'101'
,
'username'
=>
'demo'
,
'password'
=>
'demo'
,
'authKey'
=>
'test101key'
,
)
,
)
;
]
,
]
;
public
static
function
findIdentity
(
$id
)
{
...
...
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