Laravel Auth: These credentials do not match our records
I have recently run into some problems with Authentication/Login.
User registration works fine, but when I try to login using the same credentials created during registration, the app throws up this error:
These credentials do not match our records
I have also looked in the users table within the database and all the fields from the registration form is captured. I am just wondering why the app fails to retrieve these from the database.
Feel free to look through my code below and tell me where I went wrong. Thanks in advance.
LoginController.php
namespace App\Http\Controllers\Auth;
use App\Models\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Firebase\JWT\JWT;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/dashboard';
// Get your service account's email address and private key from the JSON
key file
protected $service_account_email = "abc-123@a-b-c-
123.iam.gserviceaccount.com";
protected $private_key = "-----BEGIN PRIVATE KEY-----...";
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
$this->service_account_email = config('services.firebase.client_email');
$this->private_key = config('services.firebase.private_key');
}
/**
* Get the needed authorization credentials from the request.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
protected function credentials(Request $request)
{
$data = $request->only($this->username(), 'password');
$data['email_confirmed'] = 1;
return $data;
}
protected function authenticated(Request $request, $user)
{
$jwt = $this->create_custom_token($user,false);
session(['jwt' => $jwt]);
return redirect()->intended($this->redirectPath());
}
function create_custom_token(User $user, $is_premium_account) {
$now_seconds = time();
$payload = array(
"iss" => $this->service_account_email,
"sub" => $this->service_account_email,
"aud" => "https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit",
"iat" => $now_seconds,
"exp" => $now_seconds+(60*60), // Maximum expiration time is one hour
"uid" => $user->ref_code,
"email" => $user->email,
"name" => $user->name,
"phone_number" => $user->phone_number,
"claims" => array(
"premium_account" => $is_premium_account
)
);
return JWT::encode($payload, $this->private_key, "RS256");
}
}
Also, this is what my RegisterController.php looks like, in full:
<?php
namespace App\Http\Controllers\Auth;
use Mail;
use App\Events\UserPinReactivatedSuccessfully;
use App\Jobs\DeleteUserWithoutToken;
use App\Jobs\SendVoiceSmsMessage;
use App\Models\ActivationPinVendor;
use App\Models\Bonus;
use App\Models\BonusType;
use App\Models\User;
use App\Exceptions\InvalidConfirmationCodeException;
use App\Notifications\EmailVerificationNotification;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Auth;
use Illuminate\Auth\Events\Registered;
use Illuminate\Validation\Rule;
use App\Models\ActivationPin;
use App\Models\SmsVerificationToken;
use App\Notifications\SmsPhoneNumberVerification;
use App\Models\Profile;
use App\Models\Plan;
use App\Events\RegistrationCompleteEvent;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
const SMS_TIME_MINS = 10;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/dashboard';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware(
'guest',
[
'except' => [
'getPurchaseToken',
'postPurchaseToken',
'getBankDetails',
'postBankDetails',
'getPhoneNumber',
'postPhoneNumber',
'postSendSMSToPhoneNumber',
'getSelectPackage',
'postSelectPackage',
'postSendAsCall'
]
]
);
$this->middleware(
'auth',
[
'only' => [
'getPurchaseToken',
'postPurchaseToken',
'getBankDetails',
'postBankDetails',
'getPhoneNumber',
'postPhoneNumber',
'postSendSMSToPhoneNumber',
'getSelectPackage',
'postSelectPackage',
'postSendAsCall'
]
]
);
$this->middleware('check-activation-pin', [
'only' => [
'getBankDetails',
'getPhoneNumber',
'getSelectPackage'
]
]);
}
/**
* Handle a registration request for the application.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function register(Request $request)
{
$this->validator($request->all())->validate();
event(new Registered($user = $this->create($request->all())));
if($request->has('ref_code') && $ref_code = $request->get('ref_code')){
$referrer = User::byRefCode($ref_code);
if(
$referrer &&
!Bonus::whereBonusType(BonusType::REFERRAL_BONUS)
->whereParticipantId($user->id)
->exists()
){
$bonus = new Bonus;
$bonus->amount = 0;
$bonus->is_active = false;
$bonus->user_id = $referrer->id;
$bonus->participant_id = $user->id;
$bonus->bonus_type = BonusType::REFERRAL_BONUS;
$bonus->description = "For Inviting ".$user->email;
$bonus->save();
}
}
flash()->overlay(
'Thanks for Signing Up. Please Check your <strong>Email Inbox</strong> & <strong>Spam</strong> for an <strong>Email from mintX Club</strong>, Click on Verify, Then <strong>Login and Continue the Registration Process</strong>'
,'Verify Email & Continue Registration'
);
return redirect('/login');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\Models\User
*/
protected function create(array $data)
{
$email_confirmation_code = str_random(30);
$user = User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => $data['password'],
'email_confirmation_code' => $email_confirmation_code
]);
$user->notify(new EmailVerificationNotification);
return $user;
}
public function getPurchaseToken()
{
$user = auth()->user();
$vendors = ActivationPinVendor::whereIsActive(true)->limit(8)->orderBy('display_rotation_count')->get();
$vendors->each->incrementRotationCount();
return view('auth.purchase-token',compact('user','vendors'));
}
public function postPurchaseToken(Request $request)
{
$this->validate($request,['pin' => [
'required',
Rule::exists('activation_pins','pin')->where(function ($query) {
$query->where('usage_count', '<', ActivationPin::MAX_USAGE_COUNT)
->where('is_valid',true)
->where('is_active',false);
})
]]);
$user = auth()->user();
$pin = ActivationPin::wherePin($request->pin)->first();
$pin->is_active = true;
$pin->user_id = $user->id;
$pin->save();
$user->is_token_activated = true;
$user->purchase_expiration_date = null;
$user->save();
return redirect()->to('/register/verify-phone-number');
}
public function getSelectPackage()
{
$user = auth()->user();
$packages = Plan::whereIsActive(true)->orderBy('amount')->get();
return view('plans.list',compact('user','packages'));
}
public function postSelectPackage(Request $request)
{
$this->validate($request,[
'package_id' => 'required|exists:plans,id'
]);
$user = auth()->user();
$plan = Plan::find($request->package_id);
$profile = $user->profile;
$profile->plan_id = $plan->id;
$profile->save();
$referral = $user->referral;
if($referral){
$referral->amount = (int) BonusType::calculateAmountFor($plan->amount,BonusType::REFERRAL_BONUS);
$referral->is_visible = true;
$referral->plan_id = $plan->id;
$referral->save();
}
event(new RegistrationCompleteEvent($user));
event(new UserPinReactivatedSuccessfully($user));
return redirect()->to('/dashboard');
}
public function getBankDetails()
{
$user = auth()->user();
return view('auth.update-bank-details',compact('user'));
}
public function postBankDetails(Request $request)
{
$this->validate($request,[
'bank_name' => 'required|string|min:3',
'bank_account_number' => 'required|string|size:10|unique:profiles,bank_account_number',
'bank_account_name' => 'required|string|min:3'
]);
$user = auth()->user();
$profile_data = $request->only(['bank_name','bank_account_number','bank_account_name']);
$profile_data['user_id'] = $user->id;
$profile_data['current_activation_pin_id'] = $user->current_token ? $user->current_token->id : null;
$profile = Profile::create($profile_data);
$user->is_registration_complete = 1;
$user->save();
flash('Congratulations! Welcome to '.config('app.name'));
return redirect()->to('/register/select-plan');
}
public function getPhoneNumber($token_id = null)
{
$user = auth()->user();
$data = compact('user');
$data['confirm'] = false;
$data['timeInSeconds'] = 0;
if(!$token_id){
$unconfirmed_token = SmsVerificationToken::whereIsConfirmed(false)->whereUserId($user->id)->first();
if ($unconfirmed_token) {
if ($unconfirmed_token->created_at->addMinutes(static::SMS_TIME_MINS)->greaterThan(Carbon::now())) {
flash('A Token has already been sent to the Number you specified. Please wait '.static::SMS_TIME_MINS.' Mins before trying to send token again');
return redirect()->to('/register/verify-phone-number/' . $unconfirmed_token->id);
}
$unconfirmed_token->delete();
flash('Token Expired, Enter another Phone Number to Resend token to.')->error();
return redirect()->to('/register/verify-phone-number');
}
return view('auth.update-phone-numbers',$data);
}
$token = SmsVerificationToken::find($token_id);
if(!$token){
flash('Token Expired, Enter another Phone Number to Resend token to.')->error();
return redirect()->to('/register/verify-phone-number');
}
$expires_at = $token->created_at->addMinutes(static::SMS_TIME_MINS);
$show_call_at = $token->created_at->addMinutes(static::SMS_TIME_MINS / 2);
$data['token'] = $token;
$data['confirm'] = true;
$data['timeInSeconds'] = $expires_at->greaterThan(Carbon::now()) ? $expires_at->diffInSeconds(Carbon::now()) : 0;
$data['showAfter'] = $show_call_at->greaterThan(Carbon::now()) ? $show_call_at->diffInSeconds(Carbon::now()) : 0;
return view('auth.update-phone-numbers',$data);
}
public function postSendAsCall($token_id)
{
$user = auth()->user();
$token = SmsVerificationToken::findOrFail($token_id);
if($token->is_confirmed || $token->call_sent){
return response()->json(['confirmed' => true]);
}
$job = new SendVoiceSmsMessage($token->code,$user->routeNotificationForMessageBird());
dispatch($job);
$token->call_sent = 1;
$token->save();
return response()->json(['sent' => true]);
}
public function postPhoneNumber(Request $request)
{
$user = auth()->user();
$this->validate($request,[
'phone_number' => ['required_without:code','numeric','min:11',Rule::unique('users','phone_number')->ignore($user->id)],
'code' => 'required_without:phone_number|string',
'token_id' => 'required_with:code|numeric|exists:sms_verification_tokens,id',
]);
if($request->has('phone_number')){
$phone_number = $request->phone_number;
$unconfirmed_token = SmsVerificationToken::whereIsConfirmed(false)->whereUserId($user->id)->first();
if($unconfirmed_token) {
if ($unconfirmed_token->created_at->addMinutes(static::SMS_TIME_MINS)->greaterThan(Carbon::now())) {
flash('A Token has already been sent to the Number you specified. Please wait '.static::SMS_TIME_MINS.' Mins before trying to send token again');
return redirect()->to('/register/verify-phone-number/' . $unconfirmed_token->id);
} else {
$unconfirmed_token->delete();
}
}
$user->phone_number = $phone_number;
$user->save();
$i = SmsVerificationToken::send($phone_number,$user->id);
$user->notify(new SmsPhoneNumberVerification($i->code));
flash('Token sent via SMS')->success();
return redirect()->to('/register/verify-phone-number/'.$i->id);
}else{
$code = $request->code;
$token = SmsVerificationToken::findOrFail($request->token_id);
if($code === $token->code ){
$user->phone_number_confirmed = 1;
$user->is_activated = 1;
$user->save();
$token->is_confirmed = true;
$token->save();
return redirect()->to('/register/bank-details');
}
flash('Invalid Code entered')->error();
return redirect()->back();
}
}
public function postSendSMSToPhoneNumber(Request $request)
{
$user = auth()->user();
$this->validate($request,[
'phone_number' => 'required|numeric|min:11|unique:users,phone_number'
]);
$phone_number = $request->phone_number;
$user->phone_number = $phone_number;
$user->save();
$i = SmsVerificationToken::send($phone_number,$user->id);
$user->notify(new SmsPhoneNumberVerification($i->code));
return response()->json(['verification_code_id' => $i->id]);
}
public function confirmEmail($email_confirmation_code,Request $request)
{
if( ! $email_confirmation_code)
{
throw new InvalidConfirmationCodeException;
}
$user = User::whereEmailConfirmationCode($email_confirmation_code)->first();
if ( ! $user)
{
flash('Invalid Confirmation Code. Please Check your Email Spam or Contact Admin')->error();
return redirect()->route('login');
}
$user->email_confirmed = 1;
$user->email_confirmation_code = null;
$user->purchase_expiration_date = Carbon::now()->addHours(48);
$user->save();
flash('You have successfully verified your account. Login and Continue the Registration Process')->success()->important();
$job = new DeleteUserWithoutToken($user);
$job->delay($user->purchase_expiration_date);
$this->dispatch($job);
return redirect()->route('login');
}
}
I see something with email_confirmed. The user that is trying to login, does he have his email confirmed?
So do you see in the database a 1 in the email_confirmed column of that user? If not, could you try changing it to 1 and than try logging in again.
Are you hashing your passwords; because it doesn't look likre you're hashing your passwords? It should be like this:
'password' => bcrypt($data['password']),
Yes, @m-rk the user receives an email confirmation message and when he clicks the link, it verifies his email. In the database, it shows 1 as well. but the email_confirmation_code field in the database returns NULL
@tykus I removed hashing. Was using it earlier and it didnt work. Thought that removing it will make it work, but no it has not
Are your passwords being stored in original plain text in the database?
Yes @tykus passwords at the moment is stored as plain text. I am still in testing phase. App has not been deployed yet. This hurdle, I believe is the last one (I hope).
you definitely need hashing of your passwords. Without it it won't work and you should never store unhashed passwords.
I do not see anything at this moment that could cause a failed login.
Please make sure your passwords are hashed in your database. You should see something like $2y$1032n4u3p28y....in the password field. Make sure that the email_confirmed field is set to 1. And than try again.
Are you sure your login form is passing the correct values? You could try stepping through the login steps with xDebug or add dd($data);just before the return $data in your LoginController::credentials() method
@dakova that'll be your problem; whenever you are creating the User, hash the password like I showed above.
@tykus I have added bcrypt in the RegisterController.php. @m-rk I have also done as suggested. The password is now hashed in the DB. Still returns same error as before. Could the problem be in my UserModel, as shown below?
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Tymon\JWTAuth\Contracts\JWTSubject;
/**
* App\Models\User
*
* @property int $id
* @property string $name
* @property string $email
* @property string|null $phone_number
* @property string|null $phone_number_2
* @property string $password
* @property int $email_confirmed
* @property string|null $email_confirmation_code
* @property int $phone_number_confirmed
* @property string|null $phone_number_confirmation_code
* @property string $user_type
* @property int $is_token_activated
* @property int $is_activated
* @property int $is_registration_complete
* @property string|null $remember_token
* @property string|null $deleted_at
* @property \Carbon\Carbon|null $created_at
* @property \Carbon\Carbon|null $updated_at
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ActivationPin[] $activation_pins
* @property-read mixed $current_token
* @property-read mixed $is_admin
* @property-read mixed $is_not_admin
* @property-read mixed $is_super_admin
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
* @property-read \App\Models\Profile $profile
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User admin()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User normal()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User super()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereEmail($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereEmailConfirmationCode($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereEmailConfirmed($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereIsActivated($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereIsRegistrationComplete($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereIsTokenActivated($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User wherePassword($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User wherePhoneNumber($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User wherePhoneNumber2($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User wherePhoneNumberConfirmationCode($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User wherePhoneNumberConfirmed($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereRememberToken($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereUserType($value)
* @mixin \Eloquent
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Bonus[] $bonuses
* @property-read mixed $is_not_super
* @property-read mixed $is_vendor
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TransactionItem[] $payments_made
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TransactionItem[] $payments_received
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Transaction[] $transactions
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User vendor()
* @property string $ref_code
* @property-read \App\Models\Bonus $referral
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User byRefCode($ref_code)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereRefCode($value)
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ActivationPinGroup[] $activation_pins_for_sale
* @property-read \App\Models\PaymentIssueCount $payment_issue_count
* @method static bool|null forceDelete()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User hasActivationPinForSale()
* @method static \Illuminate\Database\Query\Builder|\App\Models\User onlyTrashed()
* @method static bool|null restore()
* @method static \Illuminate\Database\Query\Builder|\App\Models\User withTrashed()
* @method static \Illuminate\Database\Query\Builder|\App\Models\User withoutTrashed()
*/
class User extends Authenticatable
{
use Notifiable,SoftDeletes;
protected $table = 'users';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $guarded = ['id'];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token','is_auto_enabled'
];
protected $with = ['profile'];
protected $dates = ['purchase_expiration_date'];
protected $casts = ['is_auto_enabled' => 'boolean'];
protected static function boot()
{
parent::boot();
static::creating(function(User $model){
if(!isset($model->attributes['ref_code']) || empty($model->attributes['ref_code'])){
$model->ref_code = static::generateRefCode();
}
return true;
});
}
public static function generateRefCode()
{
$ref_code = strtoupper(str_random(8));
if(User::whereRefCode($ref_code)->exists()){
return static::generateRefCode();
}
return $ref_code;
}
public function activation_pins_for_sale()
{
return $this->hasMany(ActivationPinGroup::class,'vendor_id');
}
public function scopeHasActivationPinForSale($query)
{
return $query->has('activation_pins_for_sale');
}
public function scopeByRefCode($query,$ref_code)
{
return $query->where('ref_code',$ref_code)->first();
}
public function scopeAdmin($query)
{
return $query->where('user_type','admin');
}
public function scopeVendor($query)
{
return $query->where('user_type','vendor');
}
public function scopeSuper($query)
{
return $query->where('user_type','super');
}
public function scopeNormal($query)
{
return $query->where('user_type','normal');
}
public function getIsAdminAttribute()
{
return $this->is_super_admin || $this->user_type == 'admin';
}
public function getIsVendorAttribute()
{
return $this->user_type == 'vendor';
}
public function transactions()
{
return $this->hasMany(Transaction::class);
}
public function payments_made()
{
return $this->hasMany(TransactionItem::class,'payer_id')
->where('is_paid',true)
->where('is_confirmed',true)
->where('is_approved',true);
}
public function payments_received()
{
return $this->hasMany(TransactionItem::class,'receiver_id')
->where('is_paid',true)
->where('is_confirmed',true)
->where('is_approved',true);
}
public function referral()
{
return $this->hasOne(Bonus::class,'participant_id');
}
public function bonuses()
{
return $this->hasMany(Bonus::class);
}
public function profit()
{
return $this->received_amount - $this->given_amount;
}
public function getIsSuperAdminAttribute()
{
return $this->user_type == 'super';
}
public function getIsNotAdminAttribute()
{
return $this->user_type != 'admin' && $this->user_type != 'super' && $this->user_type != 'vendor';
}
public function getIsNotSuperAttribute()
{
return $this->user_type != 'super';
}
public function profile()
{
return $this->hasOne(Profile::class);
}
public function activation_pins()
{
return $this->hasMany(ActivationPin::class);
}
public function getCurrentTokenAttribute()
{
return $this->activation_pins->where('is_active',true)->first();
}
public function hasActiveToken()
{
foreach($this->activation_pins as $pin){
if($pin->is_active && $pin->is_valid){
return true;
}
}
return false;
}
public function payment_issue_count()
{
return $this->hasOne(PaymentIssueCount::class);
}
public function unfilled_testimonies()
{
return $this->hasMany(Testimony::class)->where('is_completed',false);
}
public function routeNotificationForMessageBird()
{
// if(app()->isLocal() && !config('app.live',false)){
// return '+2348168641451';
// }
if(starts_with('+',$this->phone_number))
return $this->phone_number;
if(starts_with('234',$this->phone_number))
return '+'.$this->phone_number;
$temp = str_split($this->phone_number);
$temp[0] = '+234';
return implode('',$temp);
}
}
I would suggest you just step through your code. That is the best way to figure out what is going on and not only for this occasion but in general that is the best way to understand your own code.
Use xdebug if you have it available. Otherwise just add some logging or (die(), exit statements) at some spots so you can see what is happening in your code.
Add \Log::debug('Credentials: '. var_export($data,true)) for example just before your return $data in your LoginController::credentials() method. You should see see a log entry in your log file which should contain the email, the unhashed password and the email_confirmed value set to 1.
If that is all ok, you go one level deeper, etc. etc.
If you add exit, die() or these Log::debug() messages do not forget to remove them before you go to production. Otherwise you are still storing unhashed passwords in your log file ;-)
dear @m-rk thank you so much for this. Unfortunately, after adding the Log::debug() same error remains, and no entry in my laravel.log file to this effect.
.... no entry? That is interesting. Could you replace your Log::debug() with die('HELLO?') and try again. If you do not see HELLO? printed on your screen the application is not even using that method while it should.
Please try debugging it with placing the die() on different locations to figure out from what moment it goes wrong. I can't help you any further. This is just basic debugging to figure out why something ain't working.
Hi @m-rk apologies. I skipped something in the Log::debug() earlier. It displays entries now. Thanks.
I will keep digging further till I find where the problem is and will update this thread when I find the problem (or more preferably the solution).
Thank you all so much for chipping in and your help. You have been amazing, guys!
Hi, This might help you or anyone in the future that has this problem...
As of now, version 5.7, the password is hashed for you through the auth::()
Copy and paste the following into your User.php, RegisterController, and your login.php
use Illuminate\Support\Facades\Hash;
This worked for me. Hope it helps.
Please or to participate in this conversation.