Structor CSSD

This commit is contained in:
saeid
2019-04-25 20:14:09 +04:30
parent fc162db99b
commit 14a91bdef7
72 changed files with 6957 additions and 4636 deletions
@@ -1,49 +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]));
}
}
}
<?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]));␍
}␍
}␍
}␍
@@ -1,61 +1,61 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Transformers\Json;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Reset the given user's password.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function reset(Request $request)
{
$this->validate($request, $this->rules(), $this->validationErrorMessages());
// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
$response = $this->broker()->reset(
$this->credentials($request), function ($user, $password) {
$this->resetPassword($user, $password);
}
);
if ($request->wantsJson()) {
if ($response == Password::PASSWORD_RESET) {
return response()->json(Json::response(null, trans('passwords.reset')));
} else {
return response()->json(Json::response($request->input('email'), trans($response), 202));
}
}
// If the password was successfully reset, we will redirect the user back to
// the application's home authenticated view. If there is an error we can
// redirect them back to where they came from with their error message.
return $response == Password::PASSWORD_RESET
? $this->sendResetResponse($response)
: $this->sendResetFailedResponse($request, $response);
}
}
<?php␍
namespace App\Http\Controllers\Auth;␍
use App\Http\Controllers\Controller;␍
use App\Transformers\Json;␍
use Illuminate\Foundation\Auth\ResetsPasswords;␍
use Illuminate\Http\Request;␍
use Illuminate\Support\Facades\Password;␍
class ResetPasswordController extends Controller␍
{␍
/*␍
|--------------------------------------------------------------------------␍
| Password Reset Controller␍
|--------------------------------------------------------------------------␍
|␍
| This controller is responsible for handling password reset requests␍
| and uses a simple trait to include this behavior. You're free to␍
| explore this trait and override any methods you wish to tweak.␍
|␍
*/␍
use ResetsPasswords;␍
/**␍
* Create a new controller instance.␍
*␍
* @return void␍
*/␍
public function __construct()␍
{␍
$this->middleware('guest');␍
}␍
/**␍
* Reset the given user's password.␍
*␍
* @param \Illuminate\Http\Request $request␍
* @return \Illuminate\Http\Response␍
*/␍
public function reset(Request $request)␍
{␍
$this->validate($request, $this->rules(), $this->validationErrorMessages());␍
// Here we will attempt to reset the user's password. If it is successful we␍
// will update the password on an actual user model and persist it to the␍
// database. Otherwise we will parse the error and return the response.␍
$response = $this->broker()->reset(␍
$this->credentials($request), function ($user, $password) {␍
$this->resetPassword($user, $password);␍
}␍
);␍
if ($request->wantsJson()) {␍
if ($response == Password::PASSWORD_RESET) {␍
return response()->json(Json::response(null, trans('passwords.reset')));␍
} else {␍
return response()->json(Json::response($request->input('email'), trans($response), 202));␍
}␍
}␍
// If the password was successfully reset, we will redirect the user back to␍
// the application's home authenticated view. If there is an error we can␍
// redirect them back to where they came from with their error message.␍
return $response == Password::PASSWORD_RESET␍
? $this->sendResetResponse($response)␍
: $this->sendResetFailedResponse($request, $response);␍
}␍
}␍