Reputation: 57
I create a new ASP.NET Core 3.1 MVC project. Authentication change: store user accounts in-app.
Adding new scaffolded item -> Identity -> Choose Account\login and Register
Setting:
ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<ApplicationDbContext>();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseAuthentication();
app.UseAuthorization();
}
Next I ran Update-database
:
User registration is successful.
But if I log in with the "Remember me" flag. Then the next time I go to the logging page. Fields name and password is empty. How to implement auto-filling of these fields?
Upvotes: 1
Views: 2574
Reputation: 31198
The "remember me" option determines whether the authentication cookie persists beyond the current browser session. It doesn't - and shouldn't - attempt to persist your credentials anywhere.
All modern browsers have built-in password managers, and there are plenty of extensions available for third-party password managers. Let the browser take care of remembering the login details. Anything else will inevitably be horrendously insecure.
Troy Hunt: How to build (and how not to build) a secure “remember me” feature
Upvotes: 5