asp.net-identity-2

ASP.NET Identity 2.1 - Password Reset Invalid Tokens

若如初见. 提交于 2019-12-08 10:34:19
问题 ASP.NET Identity is returning an 'Invalid token.' response when resetting a password for users. I've tried the following: URL Encode the code before sending email URL Encode & Decode the code before and after Copying the code to make sure it matches what was sent Ensured my user email is confirmed (I heard that could be a problem) Created a custom UserManager/Store etc. This is my email code: var user = await UserManager.FindByNameAsync(model.Email); var code = await UserManager

Cannot retrieve inherited custom property value from AspNetUsers table

一笑奈何 提交于 2019-12-08 06:33:46
问题 I use ASP.NET Identity 2.0 and create two different user entities inherited from ApplicationUser as posted on Implementing Inheritance with the Entity Framework 6 in an ASP.NET MVC 5 but I cannot reach these custom properties and its values (StudentNumber and Profession) while reaching custom properties defined in ApplicationUser (Name, Surname). And idea? Here is the code I tried to use for retrieving value Name , Surname , StudentNumber and Profession : Controller: public AccountController

ASP.Net Identity 2 Manage Users

早过忘川 提交于 2019-12-08 05:48:45
问题 Looking for a way to implement a simple system administrator page for managing identity 2 users. I would like to simply select the list of all users and roles and then bind the list to an editable control such as a GridView. Easy with regular datasets however the mechanics of the User Manager classes and methods are getting in the way of something which would otherwise be fairly easy. Seems like a common task but searched everywhere but found no helpful samples. FYI, this solution is designed

ASP Identity 2 + Web API Token Auth - Persistent claims not Loading

点点圈 提交于 2019-12-08 05:41:58
问题 Im having some trouble with claims in ASP.NET Web API Token Auth. Essentially I have created a user with some claims (values are being stored in the AspNetUserClaim table) but when the users identity is created, those claims are not being pulled from the database. A breakdown of my setup is as follows. User Class: Has a GenerateUserIdentityAsync method (pretty standard) and a couple of custom properties: public class LibraryUser : IdentityUser{ //Add Custom Properties Here public string

Middleware for multisite ASP.NET Identity 2

≡放荡痞女 提交于 2019-12-08 05:38:11
问题 Context : In a project, i was given the work to create a middleware that used identity 2 for authentication, replacing the simple membership project they had. I extended roles and user to my like and everything worked good. Now i need to make this middleware, multisite ready. Requirements : Each site is treated as a different application; Each username is unique, making him possible to login in multisites if he has the permissions for it; Every site has their unique roles, and they can have

EF Code First Fluent API - Cascade Delete

一世执手 提交于 2019-12-08 05:06:37
问题 I have two models: public class User { ..... public virtual UserProfile UserProfile { get; set;} } public class UserProfile { ..... public virtual User User { get; set;} } The User is the master table and the relation is one to one. One user has only one UserProfile. How can I define the relationship between User and UserProfile using EF CodeFirst Fluent API in such a way that when I delete one user from User table the user profile from Userprofile is also deleted? 回答1: Use

Adding soft delete to Identity users table

社会主义新天地 提交于 2019-12-08 02:23:33
问题 I've added a deleted at column to my Users table but obviously registering new users method provided by Identity framework still sees these users in the database, is there a way of telling it to ignore a certain column? Registration // this needs to ignore any DeletedAt where not null var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { ... } Logging in // this needs to ignore any DeletedAt where not null result = await SignInManager.PasswordSignInAsync(

Include property on ASP.Net Identity 2.0 UserManager.Users.ToListAsync and UserManager.FindByIdAsync

☆樱花仙子☆ 提交于 2019-12-07 19:49:20
问题 I am trying to implement Asp.Net Identity 2.0. I have managed so far very well with the help of this blog. But I went a slightly different road. I want some data not to be part of the User object, but rather of a newly created Customer object. I want to keep the authentication and authorization data separate from my business data. So in my case I modified the ApplicationUser class by adding a customer property: public Customer Customer { get; set; } The Customer class looks like this: public

Asp.net Identity 2.0 custom login method

别来无恙 提交于 2019-12-07 17:05:46
问题 I'm developing ASP.NET 5 application using Identity 2.0. I have two types of users: Normal - they authenticate using standard login method. Temporary - they should login based on provided token. I do not want to store temporary users, except from information required to authenticate user (some username and token). If the user provides username and valid password he should be logged in. I'm not sure how to achieve this. 回答1: You could use Identity in both scenarios simultaneously as well. For

Places you can add password validation in MVC?

蹲街弑〆低调 提交于 2019-12-07 12:47:48
问题 I've got a "ForceChangePassword" page for after "ForgotPassword" and it is randomly throwing two length requirements on the "NewPassword" field. The problem is, I never added a length requirement of 7 and have no idea where it is coming from or how to change it. Errors from ModelState The New password must be at least 6 characters long. The 'New password' field is an invalid password. Password must have 7 or more characters. if (!ModelState.IsValid) { return View(model); } // Only line