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
5284e585
Commit
5284e585
authored
Jul 21, 2013
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added some phpdoc to advanced app
parent
e2813d5c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
User.php
apps/advanced/common/models/User.php
+26
-0
No files found.
apps/advanced/common/models/User.php
View file @
5284e585
...
@@ -45,31 +45,57 @@ class User extends ActiveRecord implements Identity
...
@@ -45,31 +45,57 @@ class User extends ActiveRecord implements Identity
);
);
}
}
/**
* Finds an identity by the given ID.
*
* @param string|integer $id the ID to be looked for
* @return Identity|null the identity object that matches the given ID.
*/
public
static
function
findIdentity
(
$id
)
public
static
function
findIdentity
(
$id
)
{
{
return
static
::
find
(
$id
);
return
static
::
find
(
$id
);
}
}
/**
* Finds user by username
*
* @param string $username
* @return null|User
*/
public
static
function
findByUsername
(
$username
)
public
static
function
findByUsername
(
$username
)
{
{
return
static
::
find
(
array
(
'username'
=>
$username
,
'status'
=>
static
::
STATUS_ACTIVE
));
return
static
::
find
(
array
(
'username'
=>
$username
,
'status'
=>
static
::
STATUS_ACTIVE
));
}
}
/**
* @return int|string current user ID
*/
public
function
getId
()
public
function
getId
()
{
{
return
$this
->
id
;
return
$this
->
id
;
}
}
/**
* @return string current user auth key
*/
public
function
getAuthKey
()
public
function
getAuthKey
()
{
{
return
$this
->
auth_key
;
return
$this
->
auth_key
;
}
}
/**
* @param string $authKey
* @return boolean if auth key is valid for current user
*/
public
function
validateAuthKey
(
$authKey
)
public
function
validateAuthKey
(
$authKey
)
{
{
return
$this
->
getAuthKey
()
===
$authKey
;
return
$this
->
getAuthKey
()
===
$authKey
;
}
}
/**
* @param string $password password to validate
* @return bool if password provided is valid for current user
*/
public
function
validatePassword
(
$password
)
public
function
validatePassword
(
$password
)
{
{
return
Security
::
validatePassword
(
$password
,
$this
->
password_hash
);
return
Security
::
validatePassword
(
$password
,
$this
->
password_hash
);
...
...
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