Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-mongodb
Project
Project
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
sinan
laravel-mongodb
Commits
6e9b5f4f
Commit
6e9b5f4f
authored
Feb 12, 2016
by
Jens Segers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix auth for L5.2
parent
d425493b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
6 deletions
+45
-6
DatabaseTokenRepository.php
src/Jenssegers/Mongodb/Auth/DatabaseTokenRepository.php
+2
-3
PasswordBrokerManager.php
src/Jenssegers/Mongodb/Auth/PasswordBrokerManager.php
+22
-0
PasswordResetServiceProvider.php
src/Jenssegers/Mongodb/Auth/PasswordResetServiceProvider.php
+21
-3
No files found.
src/Jenssegers/Mongodb/Auth/DatabaseTokenRepository.php
View file @
6e9b5f4f
<?php
namespace
Jenssegers\Mongodb\Auth
;
<?php
namespace
Jenssegers\Mongodb\Auth
;
use
DateTime
;
use
DateTime
;
use
Illuminate\Auth\Passwords\DatabaseTokenRepository
as
BaseDatabaseTokenRepository
;
use
MongoDate
;
use
MongoDate
;
class
DatabaseTokenRepository
extends
\Illuminate\Auth\Passwords\
DatabaseTokenRepository
class
DatabaseTokenRepository
extends
Base
DatabaseTokenRepository
{
{
/**
/**
* Build the record payload for the table.
* Build the record payload for the table.
...
@@ -28,9 +29,7 @@ class DatabaseTokenRepository extends \Illuminate\Auth\Passwords\DatabaseTokenRe
...
@@ -28,9 +29,7 @@ class DatabaseTokenRepository extends \Illuminate\Auth\Passwords\DatabaseTokenRe
// Convert MongoDate to a date string.
// Convert MongoDate to a date string.
if
(
$token
[
'created_at'
]
instanceof
MongoDate
)
{
if
(
$token
[
'created_at'
]
instanceof
MongoDate
)
{
$date
=
new
DateTime
;
$date
=
new
DateTime
;
$date
->
setTimestamp
(
$token
[
'created_at'
]
->
sec
);
$date
->
setTimestamp
(
$token
[
'created_at'
]
->
sec
);
$token
[
'created_at'
]
=
$date
->
format
(
'Y-m-d H:i:s'
);
$token
[
'created_at'
]
=
$date
->
format
(
'Y-m-d H:i:s'
);
}
elseif
(
is_array
(
$token
[
'created_at'
])
and
isset
(
$token
[
'created_at'
][
'date'
]))
{
}
elseif
(
is_array
(
$token
[
'created_at'
])
and
isset
(
$token
[
'created_at'
][
'date'
]))
{
$token
[
'created_at'
]
=
$token
[
'created_at'
][
'date'
];
$token
[
'created_at'
]
=
$token
[
'created_at'
][
'date'
];
...
...
src/Jenssegers/Mongodb/Auth/PasswordBrokerManager.php
0 → 100644
View file @
6e9b5f4f
<?php
namespace
Jenssegers\Mongodb\Auth
;
use
Illuminate\Auth\Passwords\PasswordBrokerManager
as
BasePasswordBrokerManager
;
class
PasswordBrokerManager
extends
BasePasswordBrokerManager
{
/**
* Create a token repository instance based on the given configuration.
*
* @param array $config
* @return \Illuminate\Auth\Passwords\TokenRepositoryInterface
*/
protected
function
createTokenRepository
(
array
$config
)
{
return
new
DatabaseTokenRepository
(
$this
->
app
[
'db'
]
->
connection
(),
$config
[
'table'
],
$this
->
app
[
'config'
][
'app.key'
],
$config
[
'expire'
]
);
}
}
src/Jenssegers/Mongodb/Auth/PasswordResetServiceProvider.php
View file @
6e9b5f4f
<?php
namespace
Jenssegers\Mongodb\Auth
;
<?php
namespace
Jenssegers\Mongodb\Auth
;
use
Jenssegers\Mongodb\Auth\DatabaseTokenRepository
as
DbRepository
;
use
Illuminate\Auth\Passwords\PasswordResetServiceProvider
as
BasePasswordResetServiceProvider
;
class
PasswordResetServiceProvider
extends
\Illuminate\Auth\Passwords\
PasswordResetServiceProvider
class
PasswordResetServiceProvider
extends
Base
PasswordResetServiceProvider
{
{
/**
/**
* Register the token repository implementation.
* Register the token repository implementation.
...
@@ -18,10 +18,28 @@ class PasswordResetServiceProvider extends \Illuminate\Auth\Passwords\PasswordRe
...
@@ -18,10 +18,28 @@ class PasswordResetServiceProvider extends \Illuminate\Auth\Passwords\PasswordRe
// interface, and is responsible for the actual storing of auth tokens and
// interface, and is responsible for the actual storing of auth tokens and
// their e-mail addresses. We will inject this table and hash key to it.
// their e-mail addresses. We will inject this table and hash key to it.
$table
=
$app
[
'config'
][
'auth.password.table'
];
$table
=
$app
[
'config'
][
'auth.password.table'
];
$key
=
$app
[
'config'
][
'app.key'
];
$key
=
$app
[
'config'
][
'app.key'
];
$expire
=
$app
[
'config'
]
->
get
(
'auth.password.expire'
,
60
);
$expire
=
$app
[
'config'
]
->
get
(
'auth.password.expire'
,
60
);
return
new
DbRepository
(
$connection
,
$table
,
$key
,
$expire
);
return
new
DatabaseTokenRepository
(
$connection
,
$table
,
$key
,
$expire
);
});
}
/**
* Register the password broker instance.
*
* @return void
*/
protected
function
registerPasswordBroker
()
{
$this
->
app
->
singleton
(
'auth.password'
,
function
(
$app
)
{
return
new
PasswordBrokerManager
(
$app
);
});
$this
->
app
->
bind
(
'auth.password.broker'
,
function
(
$app
)
{
return
$app
->
make
(
'auth.password'
)
->
broker
();
});
});
}
}
}
}
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