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
30bb30cd
Commit
30bb30cd
authored
9 years ago
by
Jens Segers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Overwrite registerPasswordBroker with custom broker
parent
c3ea71b3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
7 deletions
+62
-7
DatabaseTokenRepository.php
src/Jenssegers/Mongodb/Auth/DatabaseTokenRepository.php
+2
-1
PasswordBrokerManager.php
src/Jenssegers/Mongodb/Auth/PasswordBrokerManager.php
+22
-0
PasswordResetServiceProvider.php
src/Jenssegers/Mongodb/Auth/PasswordResetServiceProvider.php
+19
-3
AuthTest.php
tests/AuthTest.php
+1
-1
TestCase.php
tests/TestCase.php
+18
-2
No files found.
src/Jenssegers/Mongodb/Auth/DatabaseTokenRepository.php
View file @
30bb30cd
<?php
namespace
Jenssegers\Mongodb\Auth
;
use
Illuminate\Auth\Passwords\DatabaseTokenRepository
as
BaseDatabaseTokenRepository
;
use
MongoDB\BSON\UTCDateTime
;
class
DatabaseTokenRepository
extends
\Illuminate\Auth\Passwords\
DatabaseTokenRepository
class
DatabaseTokenRepository
extends
Base
DatabaseTokenRepository
{
/**
* Build the record payload for the table.
...
...
This diff is collapsed.
Click to expand it.
src/Jenssegers/Mongodb/Auth/PasswordBrokerManager.php
0 → 100644
View file @
30bb30cd
<?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'
]
);
}
}
This diff is collapsed.
Click to expand it.
src/Jenssegers/Mongodb/Auth/PasswordResetServiceProvider.php
View file @
30bb30cd
<?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.
...
...
@@ -23,7 +23,23 @@ class PasswordResetServiceProvider extends \Illuminate\Auth\Passwords\PasswordRe
$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
();
});
}
}
This diff is collapsed.
Click to expand it.
tests/AuthTest.php
View file @
30bb30cd
...
...
@@ -24,7 +24,7 @@ class AuthTest extends TestCase
$this
->
assertTrue
(
Auth
::
check
());
}
public
function
testRemind
()
public
function
testRemind
Old
()
{
if
(
Application
::
VERSION
>=
'5.2'
)
{
return
;
...
...
This diff is collapsed.
Click to expand it.
tests/TestCase.php
View file @
30bb30cd
...
...
@@ -2,6 +2,22 @@
class
TestCase
extends
Orchestra\Testbench\TestCase
{
/**
* Get application providers.
*
* @param \Illuminate\Foundation\Application $app
*
* @return array
*/
protected
function
getApplicationProviders
(
$app
)
{
$providers
=
parent
::
getApplicationProviders
(
$app
);
unset
(
$providers
[
array_search
(
'Illuminate\Auth\Passwords\PasswordResetServiceProvider'
,
$providers
)]);
return
$providers
;
}
/**
* Get package providers.
*
...
...
@@ -11,8 +27,8 @@ class TestCase extends Orchestra\Testbench\TestCase
protected
function
getPackageProviders
(
$app
)
{
return
[
'Jenssegers\Mongodb\MongodbServiceProvider'
,
'Jenssegers\Mongodb\Auth\PasswordResetServiceProvider'
Jenssegers\Mongodb\MongodbServiceProvider
::
class
,
Jenssegers\Mongodb\Auth\PasswordResetServiceProvider
::
class
,
];
}
...
...
This diff is collapsed.
Click to expand it.
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