disable verify peer && fixbug

This commit is contained in:
神楽坂 白 2024-06-12 13:17:03 +08:00
parent d27777992c
commit 616637d78a
4 changed files with 86 additions and 4 deletions

View File

@ -3,7 +3,9 @@
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Coderflex\LaravelTurnstile\Rules\TurnstileCheck;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Http\Request;
class ForgotPasswordController extends Controller
{
@ -16,7 +18,22 @@ class ForgotPasswordController extends Controller
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
*/
use SendsPasswordResetEmails;
/**
* Validate the email for the given request.
*
* @param \Illuminate\Http\Request $request
* @return void
*/
protected function validateEmail(Request $request)
{
$request->validate([
'email' => 'required|email',
'cf-turnstile-response' => ['required', new TurnstileCheck()],
]);
}
}

View File

@ -94,7 +94,7 @@ function ($attribute, $value, $fail) {
$key = Crypt::decryptString($key);
$key = json_decode($key, true);
if (time() - $key['time'] > 300) {
throw new Exception("The token has expired.", 400);
throw new Exception("The token has expired.", 419);
}
// if (!empty($key['id'])) {
// $where[] = ['id', '>', $key['id']];
@ -104,7 +104,7 @@ function ($attribute, $value, $fail) {
// $where[] = ['received_at', '>', Carbon::now()->subSeconds(60)];
// }
} catch (\Throwable $th) {
return abort(400, $th->getMessage());
return abort($th->getCode(), $th->getMessage());
}
$email_list = Mail::where($where)

View File

@ -44,6 +44,14 @@
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
'verify_peer' => false,
'stream' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
],
],
'ses' => [

View File

@ -1 +1,58 @@
@extends('adminlte::auth.passwords.email')
@extends('adminlte::auth.auth-page', ['auth_type' => 'login'])
@php( $password_email_url = View::getSection('password_email_url') ?? config('adminlte.password_email_url', 'password/email') )
@if (config('adminlte.use_route_url', false))
@php( $password_email_url = $password_email_url ? route($password_email_url) : '' )
@else
@php( $password_email_url = $password_email_url ? url($password_email_url) : '' )
@endif
@section('auth_header', __('adminlte::adminlte.password_reset_message'))
@section('auth_body')
@if(session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
@endif
<form action="{{ $password_email_url }}" method="post">
@csrf
{{-- Email field --}}
<div class="input-group mb-3">
<input type="email" name="email" class="form-control @error('email') is-invalid @enderror"
value="{{ old('email') }}" placeholder="{{ __('adminlte::adminlte.email') }}" autofocus>
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-envelope {{ config('adminlte.classes_auth_icon', '') }}"></span>
</div>
</div>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="input-group mb-3">
<x-turnstile-widget theme="auto"/>
@error('cf-turnstile-response')
<span class="invalid-feedback" style="display: block;" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
{{-- Send reset link button --}}
<button type="submit" class="btn btn-block {{ config('adminlte.classes_auth_btn', 'btn-flat btn-primary') }}">
<span class="fas fa-share-square"></span>
{{ __('adminlte::adminlte.send_password_reset_link') }}
</button>
</form>
@stop