当前位置:网站首页>ASP. NET CORE3. 1. Solution to login failure after identity registers users
ASP. NET CORE3. 1. Solution to login failure after identity registers users
2022-04-23 17:05:00 【begeneral】
Let's look at the failure first :
This is a user I registered with my own email , Registration was successful , There is also this record in the database
But you see EmailConfirmed The value of the field is 0, It means that this mailbox has not been verified . Generally speaking , If it is registered by email , The system will send a verification email to your email . But I didn't verify this email here .
In fact, the problem lies in this field , The solution is to let Identity Don't verify this email when logging in , The code is as follows :
services.Configure<IdentityOptions>(options =>
{
// Password settings. Password configuration
options.Password.RequireDigit = true;
options.Password.RequireLowercase = true;
options.Password.RequireNonAlphanumeric = true;
options.Password.RequireUppercase = true;
options.Password.RequiredLength = 6;
options.Password.RequiredUniqueChars = 1;
// Set whether an authenticated mailbox is required for login
options.SignIn.RequireConfirmedAccount = false;
// Lockout settings. Lock settings
options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(5);
options.Lockout.MaxFailedAccessAttempts = 5;
options.Lockout.AllowedForNewUsers = true;
});
The property set is :options.SignIn.RequireConfirmedAccount. Log in again after setting , It is found that the login succeeded .
We can also from ASP.NET CORE Source code to find the answer ( Need to download first ASP.NET CORE3.1 Source code ). The function we use to log in is SignInManager Class PasswordSignInAsync function ,
Source location :aspnetcore\src\Identity, open Identity.sln Solution , find src\Microsoft.AspNetCore.Identiy\SignInManager.cs file . find PasswordSignInAsync After the function , Go step by step
After the definition of the subfunction , find CanSignInAsync function , The screenshot of the function code is as follows :
The setting just now is judged here , The log output here can also be in ASP.NET CORE The console sees :
版权声明
本文为[begeneral]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230554081936.html
边栏推荐
- Go language RPC communication
- STM32__03—初识定时器
- Generation of barcode and QR code
- ◰GL-着色器处理程序封装
- Path environment variable
- 【WPF绑定3】 ListView基础绑定和数据模板绑定
- On lambda powertools typescript
- Derivation of Σ GL perspective projection matrix
- Go language, array, string, slice
- Deeply understand the relevant knowledge of 3D model (modeling, material mapping, UV, normal), and the difference between displacement mapping, bump mapping and normal mapping
猜你喜欢
Shell脚本——Shell编程规范及变量
Milvus 2.0 質量保障系統詳解
JS, entries(), keys(), values(), some(), object Assign() traversal array usage
Smart doc + Torna generate interface document
VLAN advanced technology, VLAN aggregation, super VLAN, sub VLAN
Dancenn: overview of byte self-developed 100 billion scale file metadata storage system
文件操作《二》(5000字总结篇)
Feign report 400 processing
Customize my_ Strcpy and library strcpy [analog implementation of string related functions]
1-1 NodeJS
随机推荐
_ Mold_ Board_
Regular filtering of Intranet addresses and segments
org. apache. parquet. schema. InvalidSchemaException: A group type can not be empty. Parquet does not su
CentOS MySQL multi instance deployment
VLAN advanced technology, VLAN aggregation, super VLAN, sub VLAN
Lock lock
Pseudo Distributed installation spark
Generate random numbers with high quality and Gaussian distribution
Smart doc + Torna generate interface document
Your brain expands and shrinks over time — these charts show how
Shortcut keys (multiline)
groutine
The new MySQL table has a self increasing ID of 20 bits. The reason is
Freecodecamp ---- budget & category exercise
VLAN高级技术,VLAN聚合,超级Super VLAN ,Sub VLAN
MySQL modify master database
Getting started with JDBC
New keyword learning and summary
文件操作《二》(5000字总结篇)
Modify the test case name generated by DDT