amirreza
6 ماه پیش توسط amirreza مطرح شد
3 پاسخ

خطای ۴۱۹ csrf

سلام خسته نباشید من در پروژه خودم از @csrf استفاده کردم پروژه بر روی هاست بردم خطای 419 میده

 <form action="{{ route('auth.register')  }}" method="post" autocomplete="off" >
                            @csrf
                            <div class="orgin-input">
                                <div class="orgin-input-iner">
                                    <input  type="text"   name="name" id="" placeholder="نام و نام خانوادگی خود را وارد کنید">
                                    @error('name')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                    @enderror
                                    <div class="info-ix">
                                        <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                            <circle cx="12" cy="6" r="4" stroke="#1C274C" stroke-width="1.5"/>
                                            <path
                                                d="M19.9975 18C20 17.8358 20 17.669 20 17.5C20 15.0147 16.4183 13 12 13C7.58172 13 4 15.0147 4 17.5C4 19.9853 4 22 12 22C14.231 22 15.8398 21.8433 17 21.5634"
                                                stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
                                        </svg>
                                    </div>
                                </div>
                            </div>
                            <div class="left-input">
                                <div class="left-input-iner">
                                    <input type="text" name="email" id="" class="left-s-input @error('email') is-invalid @enderror"
                                           placeholder="ایمیل خود را وارد کنید">
                                    @error('email')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                    @enderror
                                    <div class="info-ix">
                                        <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                            <path
                                                d="M16 12C16 14.2091 14.2091 16 12 16C9.79086 16 8 14.2091 8 12C8 9.79086 9.79086 8 12 8C14.2091 8 16 9.79086 16 12ZM16 12V13.5C16 14.8807 17.1193 16 18.5 16V16C19.8807 16 21 14.8807 21 13.5V12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21H16"
                                                stroke="#000000" stroke-width="2" stroke-linecap="round"
                                                stroke-linejoin="round"/>
                                        </svg>
                                    </div>
                                </div>
                            </div>
                            <div class="left-input">
                                <div class="left-input-iner">
                                    <input type="number" name="phone" class="phonNumber  @error('phone') is-invalid @enderror"
                                           placeholder="شماره تلفن خود را وارد کنید"
                                           maxlength="10" pattern="\d*">

                                    <div class="info-ix">
                                        <span>
                                          98+
                                        </span>
                                    </div>
                                    @error('phone')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                    @enderror
                                </div>
                            </div>
                            <div class="left-input">
                                <div class="left-input-iner">
                                    <input type="password" name="password" id="password" class="left-s-input @error('password') is-invalid @enderror"
                                           placeholder="رمز عبور خود را وارد کنید">
                                    @error('password')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                    @enderror
                                    <div class="info-ix cha">
                                        <svg class="eye" viewBox="0 0 24 24" fill="none"
                                             xmlns="http://www.w3.org/2000/svg">
                                            <path
                                                d="M15.58 12C15.58 13.98 13.98 15.58 12 15.58C10.02 15.58 8.42004 13.98 8.42004 12C8.42004 10.02 10.02 8.42004 12 8.42004C13.98 8.42004 15.58 10.02 15.58 12Z"
                                                stroke="#292D32" stroke-width="1.5" stroke-linecap="round"
                                                stroke-linejoin="round"/>
                                            <path
                                                d="M12 20.27C15.53 20.27 18.82 18.19 21.11 14.59C22.01 13.18 22.01 10.81 21.11 9.39997C18.82 5.79997 15.53 3.71997 12 3.71997C8.46997 3.71997 5.17997 5.79997 2.88997 9.39997C1.98997 10.81 1.98997 13.18 2.88997 14.59C5.17997 18.19 8.46997 20.27 12 20.27Z"
                                                stroke="#292D32" stroke-width="1.5" stroke-linecap="round"
                                                stroke-linejoin="round"/>
                                        </svg>
                                        <svg class="eye-slash" viewBox="0 0 24 24" fill="none"
                                             xmlns="http://www.w3.org/2000/svg">
                                            <path
                                                d="M14.53 9.47004L9.47004 14.53C8.82004 13.88 8.42004 12.99 8.42004 12C8.42004 10.02 10.02 8.42004 12 8.42004C12.99 8.42004 13.88 8.82004 14.53 9.47004Z"
                                                stroke="#292D32" stroke-width="1.5" stroke-linecap="round"
                                                stroke-linejoin="round"/>
                                            <path
                                                d="M17.82 5.76998C16.07 4.44998 14.07 3.72998 12 3.72998C8.46997 3.72998 5.17997 5.80998 2.88997 9.40998C1.98997 10.82 1.98997 13.19 2.88997 14.6C3.67997 15.84 4.59997 16.91 5.59997 17.77"
                                                stroke="#292D32" stroke-width="1.5" stroke-linecap="round"
                                                stroke-linejoin="round"/>
                                            <path
                                                d="M8.42004 19.5301C9.56004 20.0101 10.77 20.2701 12 20.2701C15.53 20.2701 18.82 18.1901 21.11 14.5901C22.01 13.1801 22.01 10.8101 21.11 9.40005C20.78 8.88005 20.42 8.39005 20.05 7.93005"
                                                stroke="#292D32" stroke-width="1.5" stroke-linecap="round"
                                                stroke-linejoin="round"/>
                                            <path d="M15.5099 12.7C15.2499 14.11 14.0999 15.26 12.6899 15.52"
                                                  stroke="#292D32"
                                                  stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
                                            <path d="M9.47 14.53L2 22" stroke="#292D32" stroke-width="1.5"
                                                  stroke-linecap="round"
                                                  stroke-linejoin="round"/>
                                            <path d="M22 2L14.53 9.47" stroke="#292D32" stroke-width="1.5"
                                                  stroke-linecap="round"
                                                  stroke-linejoin="round"/>
                                        </svg>
                                    </div>
                                </div>
                            </div>
                            <div class="left-input">
                                <div class="left-input-iner">
                                    <input type="password" name="password_confirmation" id="passwordCheck"
                                           class="left-s-input password-check @error('password_confirmation') is-invalid @enderror"
                                           placeholder="رمز عبور خود را تکرار کنید">
                                    @error('password_confirmation')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                    @enderror
                                    <div class="info-ix cha">
                                        <svg class="eye" viewBox="0 0 24 24" fill="none"
                                             xmlns="http://www.w3.org/2000/svg">
                                            <path
                                                d="M15.58 12C15.58 13.98 13.98 15.58 12 15.58C10.02 15.58 8.42004 13.98 8.42004 12C8.42004 10.02 10.02 8.42004 12 8.42004C13.98 8.42004 15.58 10.02 15.58 12Z"
                                                stroke="#292D32" stroke-width="1.5" stroke-linecap="round"
                                                stroke-linejoin="round"/>
                                            <path
                                                d="M12 20.27C15.53 20.27 18.82 18.19 21.11 14.59C22.01 13.18 22.01 10.81 21.11 9.39997C18.82 5.79997 15.53 3.71997 12 3.71997C8.46997 3.71997 5.17997 5.79997 2.88997 9.39997C1.98997 10.81 1.98997 13.18 2.88997 14.59C5.17997 18.19 8.46997 20.27 12 20.27Z"
                                                stroke="#292D32" stroke-width="1.5" stroke-linecap="round"
                                                stroke-linejoin="round"/>
                                        </svg>
                                        <svg class="eye-slash" viewBox="0 0 24 24" fill="none"
                                             xmlns="http://www.w3.org/2000/svg">
                                            <path
                                                d="M14.53 9.47004L9.47004 14.53C8.82004 13.88 8.42004 12.99 8.42004 12C8.42004 10.02 10.02 8.42004 12 8.42004C12.99 8.42004 13.88 8.82004 14.53 9.47004Z"
                                                stroke="#292D32" stroke-width="1.5" stroke-linecap="round"
                                                stroke-linejoin="round"/>
                                            <path
                                                d="M17.82 5.76998C16.07 4.44998 14.07 3.72998 12 3.72998C8.46997 3.72998 5.17997 5.80998 2.88997 9.40998C1.98997 10.82 1.98997 13.19 2.88997 14.6C3.67997 15.84 4.59997 16.91 5.59997 17.77"
                                                stroke="#292D32" stroke-width="1.5" stroke-linecap="round"
                                                stroke-linejoin="round"/>
                                            <path
                                                d="M8.42004 19.5301C9.56004 20.0101 10.77 20.2701 12 20.2701C15.53 20.2701 18.82 18.1901 21.11 14.5901C22.01 13.1801 22.01 10.8101 21.11 9.40005C20.78 8.88005 20.42 8.39005 20.05 7.93005"
                                                stroke="#292D32" stroke-width="1.5" stroke-linecap="round"
                                                stroke-linejoin="round"/>
                                            <path d="M15.5099 12.7C15.2499 14.11 14.0999 15.26 12.6899 15.52"
                                                  stroke="#292D32"
                                                  stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
                                            <path d="M9.47 14.53L2 22" stroke="#292D32" stroke-width="1.5"
                                                  stroke-linecap="round"
                                                  stroke-linejoin="round"/>
                                            <path d="M22 2L14.53 9.47" stroke="#292D32" stroke-width="1.5"
                                                  stroke-linecap="round"
                                                  stroke-linejoin="round"/>
                                        </svg>
                                    </div>
                                </div>
                            </div>
                            <button type="submit" class="submit-form">برو بریم !</button>
                        </form>

دلیل خاصی داره؟


ثبت پرسش جدید
محمد رضا
تخصص : Full Stack Developer
@salar.mohammad2013 6 ماه پیش آپدیت شد
0

سلام
داداش خطای 419 برای من همیشه زمانی پیش میامد که کاربر لاگین کرده و من مجدد میخوام لاگین کنم
دلیل این اشتباه هم به خاطر https بود
شما باید یه ریدایرکت از http به https قرار بدی توی پروژت
جدای از این که توی سرور کانفیگ لازم رو باید انجام بدی که ssl داشته باشی و ریدایرکت هم بشه توی پروژه هم به شکل زیر میتونی این کار رو انجام بدی
توی app و پوشه providers فایل appServiceProvider رو باز کن و بخش بوت رو به شکل زیر تغییر بده

    public function boot()
    {
        if($this->app->environment('production')) {
            \URL::forceScheme('https');
        }
    }

و خب از خود کد مشخصه که وقتی میری روی سرور بارگزاری میکنیش لازم هست که فایل .env رو تغییر بدی و حالت پروداکشن باشه

APP_ENV=production

توی خود راکت بخش پرسش پاسخ سرچ کن خیلی زیاد دوستان این خطا رو داشتن و روش های مختلفی برای حلش هست چون دلایل مختلفی هم داره ( فقط توی سرچ بخش پرسش پاسخ بنویس 419 و اینتر کن همین )
برای من این مورد بوده


amirreza
@contel021 6 ماه پیش مطرح شد
0

سلام خوبی بیین خطای من با پروایدر درست نشد
و این مشکل در تموم فرم های من هست از لاگین تا رجیستر تا .....


محمد رضا
تخصص : Full Stack Developer
@salar.mohammad2013 6 ماه پیش مطرح شد
0

یه بررسی بکن بخش network مرور گر ببین ادرس هایی که درخواست میره درست هست یا نه
بعد اون خطا رو هم دقت کن چی میگه دقیقا توی سرور
اگر توی لوکال درست باشه csrf و مشکل https نباشه ایده ای ندارم واقعا
شما خطای توی کنسول و بخش نتوورک مرورگرتو بررسی کن برامون به اشتراک بزار و اینکه ادرس route که درخواست میده ببین اشتباه نشه چون توی هاست یکمی پیش میاد که اشتباه باشه درخواستامون


برای ارسال پاسخ لازم است وارد شده یا ثبت‌نام کنید

ورود یا ثبت‌نام