Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-adminpanel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
laravel-adminpanel
Commits
f39415e0
Commit
f39415e0
authored
Dec 04, 2017
by
Viral Solani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP
parent
bcfbaa1e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
6 deletions
+39
-6
ResetPasswordController.php
app/Http/Controllers/Api/V1/ResetPasswordController.php
+39
-6
No files found.
app/Http/Controllers/Api/V1/ResetPasswordController.php
View file @
f39415e0
...
@@ -3,26 +3,59 @@
...
@@ -3,26 +3,59 @@
namespace
App\Http\Controllers\Api\V1
;
namespace
App\Http\Controllers\Api\V1
;
use
App\Repositories\Frontend\Access\User\UserRepository
;
use
App\Repositories\Frontend\Access\User\UserRepository
;
use
Tymon\JWTAuth\JWTAuth
;
use
Illuminate\Support\Facades\Password
;
use
Illuminate\Foundation\Auth\ResetsPasswords
;
use
Illuminate\Foundation\Auth\ResetsPasswords
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Validator
;
/**
/**
* Class ResetPasswordController.
* Class ResetPasswordController.
*/
*/
class
ResetPasswordController
extends
APIController
class
ResetPasswordController
extends
APIController
{
{
/**
* User Repository
* @var obj
*/
protected
$user
;
/**
* Rest Password Constructor
*
* @param UserRepository $user
*/
public
function
__construct
(
UserRepository
$user
)
{
$this
->
user
=
$user
;
}
/**
/**
* Reset Password
* Reset Password
* @param Re
setPasswordRe
quest
* @param Request
* @param JWTAuth
* @param JWTAuth
*
*
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse
*/
*/
public
function
reset
Password
(
ResetPassword
Request
$request
,
JWTAuth
$JWTAuth
)
public
function
reset
(
Request
$request
,
JWTAuth
$JWTAuth
)
{
{
$validation
=
Validator
::
make
(
$request
->
all
(),
[
'token'
=>
'required'
,
'email'
=>
'required|email'
,
'password'
=>
'required|min:4|confirmed|regex:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$"'
,
]);
if
(
$validation
->
fails
())
{
return
$this
->
throwValidation
(
$validation
->
messages
()
->
first
());
}
dd
(
'viral'
);
$response
=
$this
->
broker
()
->
reset
(
$response
=
$this
->
broker
()
->
reset
(
$this
->
credentials
(
$request
),
function
(
$user
,
$password
)
{
$this
->
credentials
(
$request
),
function
(
$user
,
$password
)
{
$this
->
reset
(
$user
,
$password
);
$this
->
reset
Password
(
$user
,
$password
);
}
}
);
);
...
@@ -57,10 +90,10 @@ class ResetPasswordController extends APIController
...
@@ -57,10 +90,10 @@ class ResetPasswordController extends APIController
/**
/**
* Get the password reset credentials from the request.
* Get the password reset credentials from the request.
*
*
* @param
ResetPasswordRequest
$request
* @param $request
* @return array
* @return array
*/
*/
protected
function
credentials
(
ResetPasswordRequest
$request
)
protected
function
credentials
(
$request
)
{
{
return
$request
->
only
(
return
$request
->
only
(
'email'
,
'password'
,
'password_confirmation'
,
'token'
'email'
,
'password'
,
'password_confirmation'
,
'token'
...
@@ -74,7 +107,7 @@ class ResetPasswordController extends APIController
...
@@ -74,7 +107,7 @@ class ResetPasswordController extends APIController
* @param string $password
* @param string $password
* @return void
* @return void
*/
*/
protected
function
reset
(
$user
,
$password
)
protected
function
reset
Password
(
$user
,
$password
)
{
{
$user
->
password
=
$password
;
$user
->
password
=
$password
;
$user
->
save
();
$user
->
save
();
...
...
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