Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
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
Yeray Santana Hualde
syncEnrollments
Commits
bb764904
Commit
bb764904
authored
Aug 11, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor the Auth class method names.
parent
3b5af930
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
auth.php
system/auth.php
+8
-7
No files found.
system/auth.php
View file @
bb764904
...
@@ -72,8 +72,8 @@ class Auth {
...
@@ -72,8 +72,8 @@ class Auth {
/**
/**
* Attempt to login a user.
* Attempt to login a user.
*
*
* If the user credentials are valid. The user
ID will be stored in the session
* If the user credentials are valid. The user
's ID will be stored in the session and the
*
and
will be considered "logged in" on subsequent requests to the application.
*
user
will be considered "logged in" on subsequent requests to the application.
*
*
* The password passed to the method should be plain text, as it will be hashed
* The password passed to the method should be plain text, as it will be hashed
* by the Hash class when authenticating.
* by the Hash class when authenticating.
...
@@ -90,13 +90,13 @@ class Auth {
...
@@ -90,13 +90,13 @@ class Auth {
* @return bool
* @return bool
* @see Hash::check()
* @see Hash::check()
*/
*/
public
static
function
login
(
$username
,
$password
)
public
static
function
attempt
(
$username
,
$password
)
{
{
if
(
!
is_null
(
$user
=
call_user_func
(
Config
::
get
(
'auth.by_username'
),
$username
)))
if
(
!
is_null
(
$user
=
call_user_func
(
Config
::
get
(
'auth.by_username'
),
$username
)))
{
{
if
(
Hash
::
check
(
$password
,
$user
->
password
))
if
(
Hash
::
check
(
$password
,
$user
->
password
))
{
{
static
::
remember
(
$user
);
static
::
login
(
$user
);
return
true
;
return
true
;
}
}
...
@@ -106,16 +106,17 @@ class Auth {
...
@@ -106,16 +106,17 @@ class Auth {
}
}
/**
/**
* Login a
user without checking any credentials
.
* Login a
given user into the application
.
*
*
* This is helpful for logging in a user after a fresh registration.
* The user's ID will be stored in the session and the user will be considered
* "logged in" on subsequent requests to the application.
*
*
* Note: The user given to this method should be an object having a "id" property.
* Note: The user given to this method should be an object having a "id" property.
*
*
* @param object $user
* @param object $user
* @return void
* @return void
*/
*/
public
static
function
remember
(
$user
)
public
static
function
login
(
$user
)
{
{
static
::
$user
=
$user
;
static
::
$user
=
$user
;
...
...
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