asp.net-identity-2

Seed database for Identity 2

倾然丶 夕夏残阳落幕 提交于 2019-12-17 17:57:30
问题 I came across a problem for seeding the database with Identity v2. I separated out the IdentityModel from the MVC5 project to my Data Access Layer where I setup EF Migrations as well. So I commented out the code which use inside "IdentityConfig.cs" to create initial user and put the code inside my seed database that looks like this protected override void Seed(Repository.DataContext.IdentityDb context) { // var userManager = HttpContext.Current.GetOwinContext().GetUserManager

Asp.net identity entity framework database first approach with own table defintion

梦想的初衷 提交于 2019-12-17 16:54:31
问题 I have below four tables Role table User table UserRole table UserType table default Asp.net identity having below tables like Asp.netusers,Asp.netRoles,Asp.netuserlogins,Asp.netuserclaims,Asp.netuserroles My table doesn't match the same column name and some columns not available in my tables. can i use my own tables to utilize the feature of asp.net identity or else i need to follow the same columns used in Asp.netusers table to my User table. Is that all columns necessary to add in my table

No IUserTokenProvider is registered

隐身守侯 提交于 2019-12-17 10:17:56
问题 I recently updated Asp.Net Identity Core of my application form 1.0 to 2.0. There are new features which I wanted to try like GenerateEmailConfirmationToken , etc. I'm using this project as a reference. When the user tries to register, I get error during the execution of Post method of Register private readonly UserManager<ApplicationUser> _userManager; public ActionResult Register(RegisterViewModel model) { if (ModelState.IsValid) { var ifUserEXists = _userManager.FindByName(model.EmailId);

aspnet identity invalid token on confirmation email

南楼画角 提交于 2019-12-17 09:45:09
问题 I'm trying to confirm an account but I'm getting "invalid token." error. Here's what I'm trying: var code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); var callbackUrl = Url.Action("ConfirmacaoEmail", "Usuario", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); await UserManager.SendEmailAsync(user.Id, "Ativação de Conta", user.GetEmailAtivacao(model.Nome, callbackUrl)); if I call UserManager.ConfirmEmailAsync after this code, I can confirm the account.

ASP.NET Identity change password

霸气de小男生 提交于 2019-12-17 06:28:56
问题 I need ability to change password for user by admin. So, admin should not enter a current password of user, he should have ability to set a new password. I look at ChangePasswordAsync method, but this method requires to enter old password. So, this method is not appropriate for this task. Therefore I have made it by the following way: [HttpPost] public async Task<ActionResult> ChangePassword(ViewModels.Admin.ChangePasswordViewModel model) { var userManager = HttpContext.GetOwinContext()

How do I forcefully propagate role changes to users with ASP.NET Identity 2.0.1?

给你一囗甜甜゛ 提交于 2019-12-17 04:29:29
问题 I've read this and while it explains how role changes will eventually propagate to the user cookie after some time interval, I still don't understand how I force an immediate change to user roles. Do I really have to sign the user out when I change his roles as administrator? If so — how? If I use AuthenticationManager.SignOut(); then I sign off myself (admin), not the user, whose roles I want to change. Currently I use await UserManager.UpdateSecurityStampAsync(user.Id); to generate a new

How do I forcefully propagate role changes to users with ASP.NET Identity 2.0.1?

99封情书 提交于 2019-12-17 04:29:06
问题 I've read this and while it explains how role changes will eventually propagate to the user cookie after some time interval, I still don't understand how I force an immediate change to user roles. Do I really have to sign the user out when I change his roles as administrator? If so — how? If I use AuthenticationManager.SignOut(); then I sign off myself (admin), not the user, whose roles I want to change. Currently I use await UserManager.UpdateSecurityStampAsync(user.Id); to generate a new

Why new fb api 2.4 returns null email on MVC 5 with Identity and oauth 2?

时光毁灭记忆、已成空白 提交于 2019-12-17 02:44:08
问题 Everything used to work perfect until fb upgraded it's api to 2.4 (I had 2.3 in my previous project). Today when I add a new application on fb developers I get it with api 2.4. The problem: Now I get null email from fb ( loginInfo.email = null ). Of course I checked that the user email is in public status on fb profile, and I went over the loginInfo object but didn't find any other email address. and I google that but didn't find any answer. please any help.. I 'm kind of lost.. Thanks, My

Invalid length for a Base-64 char array or string. in UserManager.CheckPasswordAsync(user, password)

烈酒焚心 提交于 2019-12-14 03:17:24
问题 I'm learning MVC and for creating Login and Register with Custom Existing Database I followed this tutorial and created custom User Manager and Sign In Manager. It allowed me to register a user properly and users are saved in my db properly. But password is saved as string without encryption as user entered it and also while login CheckPasswordAsync returns System.FormatException: Invalid length for a Base-64 char array or string. For Implementing UserPasswordStore I followed this tutorial

Is there a way to get the user password using UserManager in ASP.NET Identity 2.0?

偶尔善良 提交于 2019-12-14 03:17:18
问题 I am using ASP.NET MVC 5.0 and Identity 2.0. I'm trying to get the user password using UserManager. It seems there is no ways to get the password back. It gives back only the password hash. Is there a way to get the user password? 来源: https://stackoverflow.com/questions/30050883/is-there-a-way-to-get-the-user-password-using-usermanager-in-asp-net-identity-2