asp.net-identity

Dapper MySQL return value

淺唱寂寞╮ 提交于 2020-08-07 04:15:02
问题 i got a problem using dapper and MySql in a ASP.net Identity project. I want to insert a user to a table users and want the autogenerated id from this insertation back. But i get a syntax error and i don´t know why. this is my code for the method insert: public void Insert(TUser member) { var id = db.Connection.ExecuteScalar<int>(@"Insert into users (UserName, PasswordHash, SecurityStamp,Email,EmailConfirmed,PhoneNumber,PhoneNumberConfirmed, AccessFailedCount,LockoutEnabled,LockoutEndDateUtc

Dapper MySQL return value

邮差的信 提交于 2020-08-07 04:12:46
问题 i got a problem using dapper and MySql in a ASP.net Identity project. I want to insert a user to a table users and want the autogenerated id from this insertation back. But i get a syntax error and i don´t know why. this is my code for the method insert: public void Insert(TUser member) { var id = db.Connection.ExecuteScalar<int>(@"Insert into users (UserName, PasswordHash, SecurityStamp,Email,EmailConfirmed,PhoneNumber,PhoneNumberConfirmed, AccessFailedCount,LockoutEnabled,LockoutEndDateUtc

Override ValidateAsync in UserValidator.cs for .NET Core Identity 2.1

心不动则不痛 提交于 2020-08-02 20:53:48
问题 I'm customizing the validation for username to allow the same username (non-unique). This is with an additional field "Deleted" as a soft delete to identity user. So the customization involves changing the current validation to check if the username already exist and deleted is false to only trigger DuplicateUserName error. What I've done is create a CustomUserValidator class, and override the ValidateAsync method in UserValidator.cs as well as the ValidateUserName method. Below is the code:

Override ValidateAsync in UserValidator.cs for .NET Core Identity 2.1

末鹿安然 提交于 2020-08-02 20:50:27
问题 I'm customizing the validation for username to allow the same username (non-unique). This is with an additional field "Deleted" as a soft delete to identity user. So the customization involves changing the current validation to check if the username already exist and deleted is false to only trigger DuplicateUserName error. What I've done is create a CustomUserValidator class, and override the ValidateAsync method in UserValidator.cs as well as the ValidateUserName method. Below is the code:

Use ASP.Net Core 2 Identity with Azure Ad single tenant authentication

痴心易碎 提交于 2020-08-02 05:04:14
问题 I would like to get help from community for one problem that I don't understand. I create asp.net core 2 web application and I would like to configure the app to be able to login from the app via aspnetuser table or by using O365 Company account . Then I followed multiple techniques described on the web included on MSDN website. The app authentication works fine but Azure add returned : Error loading external login information. I checked inside the code by generating identity views, the app

Use ASP.Net Core 2 Identity with Azure Ad single tenant authentication

霸气de小男生 提交于 2020-08-02 05:02:00
问题 I would like to get help from community for one problem that I don't understand. I create asp.net core 2 web application and I would like to configure the app to be able to login from the app via aspnetuser table or by using O365 Company account . Then I followed multiple techniques described on the web included on MSDN website. The app authentication works fine but Azure add returned : Error loading external login information. I checked inside the code by generating identity views, the app

Invalidate “Forgot Password” link after time period asp net core

百般思念 提交于 2020-07-23 07:43:27
问题 I am implementing Forgot Password scenario in an asp .net core 2.x application. I followed the default behavior Click forgot password link from login Enter email Send an email with a link /ResetPassword?code=[Some encoded string] ...etc Click the link and opens the Reset Password screen with an email, new password and confirm password. All the above is Ok, and if the user attemps to click the link in step 3, the system will deny the request saying, Invalid Token! I need to implement more

Invalidate “Forgot Password” link after time period asp net core

假装没事ソ 提交于 2020-07-23 07:42:13
问题 I am implementing Forgot Password scenario in an asp .net core 2.x application. I followed the default behavior Click forgot password link from login Enter email Send an email with a link /ResetPassword?code=[Some encoded string] ...etc Click the link and opens the Reset Password screen with an email, new password and confirm password. All the above is Ok, and if the user attemps to click the link in step 3, the system will deny the request saying, Invalid Token! I need to implement more

Invalidate “Forgot Password” link after time period asp net core

大兔子大兔子 提交于 2020-07-23 07:41:06
问题 I am implementing Forgot Password scenario in an asp .net core 2.x application. I followed the default behavior Click forgot password link from login Enter email Send an email with a link /ResetPassword?code=[Some encoded string] ...etc Click the link and opens the Reset Password screen with an email, new password and confirm password. All the above is Ok, and if the user attemps to click the link in step 3, the system will deny the request saying, Invalid Token! I need to implement more

Identity Core Primary Key as Int not able to use SignInManager

余生长醉 提交于 2020-07-22 09:48:05
问题 What I'm trying to do is the following: Setup login/logout using Identity Core, with the Primary Key as Int. I followed the following article in the ASP.NET Core Documentation: Configure Identity primary keys data type. (They use GUID's but the idea is the same). The setup is quite succesfull, the ID's are integers and the database is getting populated. However, when I try to sign in using the built-in SignInManager<ApplicationUser> and invoking the the method var result = await