Laravel 7 no Verification email sent after a user registers - laravel

I followed the instruction of the Laravel documentation 7x for Email Verification.
I didn't do it at the very beginning and before this I made changes to the the users table adding columns like firstnane, familyname, city etc.
Since then I could register correctly without any email verification.
Today I decided to add this functionality but it doesn't work.
The register process is still going on but there is no email sent and the user is directly logged.
I use the
MAIL_MAILER=log
in my .env and other mails are correctly sent and visible in the logs file.
Here is the auth routes
Auth::routes(['verify' => true]);
I have a email_verified_at column in the users table.
Any idea ?

Most likely your User model is not implementing the Illuminate\Contracts\Auth\MustVerifyEmail contract/interface.
use Illuminate\Contracts\Auth\MustVerifyEmail;
...
class User extends Model implements MustVerifyEmail
"Once this interface has been added to your model, newly registered users will automatically be sent an email containing an email verification link." - Laravel 7.x Docs - Email Verification - Model Preparation

Related

Custom 'email' Property for Laravel User Model

I am trying to configure email-verification on a Laravel 8 application.
When a user registers, the verification email will only send if the email property on my user model is named email (as per the Eloquent ORM).
Is there a way I can change the email property on my user model to something like user_email and still have email verification work?

Why can users register via the web without even verifying email?

in laravel user can register and verify email later.
Suppose A registers at www.x.com using B email (so that B cannot register at www.x.com).
when B tries to register at www.x.com using his own email he cannot register because the email is already registered or in DB unique.
So how can I prevent this from happening? I want those who can verify email are people who can register.
Just add Auth::routes(['verify' => true]); in the routes/web.php (see documentation).

How to manually resend email verification in Laravel?

I have an admin page on my site and I want an option to be able to manually resend an email verification, there are two purposes for this:
Test email verifications templates.
Debug user issues.
Does the user model have a method to do this?
If your User model implements the MustVerifyEmail interface, yes, you can manually send the notification using:
$user->sendEmailVerificationNotification();

modify auth code of laravel 5 as per my list of requirements

I have a old database on which I want to use new Laravel 5.2, i want to change its User Authentication code to my requirements like - its tablename, username field(its not a email field), its password and also need to stop laravel from encrypting the password as the password are not encrypted in the database, also I need to remove features like remember me option, register new users ... Can anyone please help/guide me.
password from users and database are one and the same - laravel shall not encrypt the password string.
I am trying to succeed in all the above things together past 2 days now. if one thing is rectify I goof up with another. specially in case of password checking - currently any / wrong password will also be allowed as a user - only username needs to be correct.
Thanx in advance.
I assume that you're using AuthController class that Laravel provides, your user model class is called User and you're using Eloquent user provider as it's the default one.
In order to change the name of the table that stores users you need add the following to your User class:
protected $table = 'your_table';
If you want to change the column that is used to login users from email to another column, you need to add the following code to your AuthController:
protected $username = 'username';
Registration won't be available to your users if you don't define routes for those actions so no need to disable that.
In order to disable remember-me functionality you need to override setRememberToken() of your User model and make it empty. This way remember-me token won't be saved for that user which will prevent user from logging-in automatically:
public setRememberToken() {}

How to reset passwords in Laravel 5?

I am working on a project using Laravel 5 and I am trying to figure out how to reset passwords. I know the migration for the password resets is already there but I remember there was a ReminderController in Laravel 4 which I could generate but I cannot find the same in Laravel 5.
I am sure that Laravel 5 ships with a password reset mechanism but I cannot exactly figure out where to send the request and the method which handles sending the emails?
I can find the views and the migration but can anyone help me find the controller method and route. If anyone can provide me with a tutorial, I could work with that too.
Laravel also includes an
Auth\PasswordController 
that contains the logic necessary to reset user passwords. We've even provided views to get you started! The views are located in the
resources/views/auth 
directory. You are free to modify these views as you wish to suit your own application's design.
Your user will receive an e-mail with a link that points to the 
getReset method
of the
PasswordController.
This method will render the password reset form and allow users to reset their passwords. After the password is reset, the user will automatically be logged into the application and redirected to /home. You can customize the post-reset redirect location by defining a redirectTo property on the PasswordController:
protected $redirectTo = '/dashboard';
Source

Resources