mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-11 02:11:05 +03:30
Come BackEnd
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Auth;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Transformers\Json;
|
||||
use App\User;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
use Illuminate\Http\Request;
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset emails and
|
||||
| includes a trait which assists in sending these notifications from
|
||||
| your application to your users. Feel free to explore this trait.
|
||||
|
|
||||
*/
|
||||
use SendsPasswordResetEmails;
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
/**
|
||||
* Send a reset link to the given user.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getResetToken(Request $request)
|
||||
{
|
||||
dd($request->all());
|
||||
$this->validate($request, ['email' => 'required|email']);
|
||||
if ($request->wantsJson()) {
|
||||
$user = User::where('email', $request->input('email'))->first();
|
||||
if (!$user) {
|
||||
return response()->json(Json::response(null, trans('passwords.user')), 400);
|
||||
}
|
||||
$token = $this->broker()->createToken($user);
|
||||
return response()->json(Json::response(['token' => $token]));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user