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
39d3ccb8
Commit
39d3ccb8
authored
Jul 06, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring / comment clean-up on Auth class.
parent
6fc0770b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
19 deletions
+4
-19
auth.php
system/auth.php
+4
-19
No files found.
system/auth.php
View file @
39d3ccb8
...
...
@@ -29,15 +29,12 @@ class Auth {
/**
* Get the current user of the application.
*
* The user will be loaded using the user ID stored in the session.
*
* @return object
*/
public
static
function
user
()
{
// -----------------------------------------------------
// Verify that sessions are enabled. Since the user ID
// is stored in the session, we can't authenticate
// without a session driver specified.
// -----------------------------------------------------
if
(
Config
::
get
(
'session.driver'
)
==
''
)
{
throw
new
\Exception
(
"You must specify a session driver before using the Auth class."
);
...
...
@@ -45,9 +42,6 @@ class Auth {
$model
=
static
::
model
();
// -----------------------------------------------------
// Load the user using the ID stored in the session.
// -----------------------------------------------------
if
(
is_null
(
static
::
$user
)
and
Session
::
has
(
static
::
$key
))
{
static
::
$user
=
$model
::
find
(
Session
::
get
(
static
::
$key
));
...
...
@@ -70,11 +64,8 @@ class Auth {
if
(
!
is_null
(
$user
))
{
// -----------------------------------------------------
// Hash the password. If a salt is present on the user
// record, we will recreate the hashed password using
// the salt. Otherwise, we will just use a plain hash.
// -----------------------------------------------------
// If a salt is present on the user record, we will recreate the hashed password
// using the salt. Otherwise, we will just use a plain hash.
$password
=
(
isset
(
$user
->
salt
))
?
Hash
::
make
(
$password
,
$user
->
salt
)
->
value
:
sha1
(
$password
);
if
(
$user
->
password
===
$password
)
...
...
@@ -97,13 +88,7 @@ class Auth {
*/
public
static
function
logout
()
{
// -----------------------------------------------------
// By removing the user ID from the session, the user
// will no longer be considered logged in on subsequent
// requests to the application.
// -----------------------------------------------------
Session
::
forget
(
static
::
$key
);
static
::
$user
=
null
;
}
...
...
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