أحاول تسجيل الدخول لتطبيق لارافيل لكن بالرغم من إدخال البيانات الصحيحة يظهر لي الخطأ التالي:
These credentials do not match our records
و هذا المُتحكم الخاص بتسجيل الدخول:
<?php
namespaceApp\Http\Controllers\Auth;useApp\Http\Controllers\Controller;useApp\Notifications\LoginToWebsite asLoginToWebsiteNotification;useApp\Providers\RouteServiceProvider;useApp\Rules\ReCaptcha;useIlluminate\Foundation\Auth\AuthenticatesUsers;useIlluminate\Http\Request;useApp\Models\User;useApp\Models\ActiveCode;classLoginControllerextendsController{useAuthenticatesUsers,TwoFactorAuthenticate;/**
* Where to redirect users after login.
*
* @var string
*/protected $redirectTo =RouteServiceProvider::HOME;/**
* Create a new controller instance.
*
* @return void
*/publicfunction __construct(){
$this->middleware('guest')->except('logout');}protectedfunction authenticated(Request $request, $user){
$user->notify(newLoginToWebsiteNotification());return $this->loggendin($request , $user);}protectedfunction validateLogin(Request $request){
$request->validate([
$this->username()=>'required|string','password'=>'required|string','g-recaptcha-response'=>['required',newRecaptcha]],['g-recaptcha-response.required'=>'Click to confirm you are not a bot']);}}
و هذا الكود الخاص بالنموذج User:
<?php
namespaceApp\Models;useApp\Notifications\ResetPassword asResetPasswordNotification;useApp\Notifications\VerifyEmail asVerifyEmailNotification;useIlluminate\Contracts\Auth\MustVerifyEmail;useIlluminate\Database\Eloquent\Factories\HasFactory;useIlluminate\Foundation\Auth\User asAuthenticatable;useIlluminate\Notifications\Notifiable;classUserextendsAuthenticatableimplementsMustVerifyEmail{useNotifiable;/**
* The attributes that are mass assignable.
*
* @var array
*/protected $fillable =['name','email','password','two_factor_type','phone_number','is_superuser','is_staff'];/**
* The attributes that should be hidden for arrays.
*
* @var array
*/protected $hidden =['password','remember_token',];/**
* The attributes that should be cast to native types.
*
* @var array
*/protected $casts =['email_verified_at'=>'datetime',];/**
* Send the password reset notification.
*
* @param string $token
* @return void
*/publicfunction sendPasswordResetNotification($token){
$this->notify(newResetPasswordNotification($token));}/**
* Send the email verification notification.
*
* @return void
*/publicfunction sendEmailVerificationNotification(){
$this->notify(newVerifyEmailNotification);}publicfunction setPasswordAttribute($value){
$this->attributes['password']= bcrypt($value);}publicfunction isSuperUser(){return $this->is_superuser;}publicfunction isStaffUser(){return $this->is_staff;}publicfunction activeCode(){return $this->hasMany(ActiveCode::class);}publicfunction hasTwoFactor($key){return $this->two_factor_type == $key;}publicfunction hasTwoFactorAuthenticatedEnabled(){return $this->two_factor_type !=='off';}publicfunction hasSmsTwoFactorAuthenticationEnabled(){return $this->two_factor_type =='sms';}}
السؤال
Mahmoud Alrashidi
أحاول تسجيل الدخول لتطبيق لارافيل لكن بالرغم من إدخال البيانات الصحيحة يظهر لي الخطأ التالي:
These credentials do not match our records
و هذا المُتحكم الخاص بتسجيل الدخول:
و هذا الكود الخاص بالنموذج User:
لم أفهم سبب المُشكلة.
3 أجوبة على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.