Is there a way to reset a user's password (in the AspNetUsers table) using SQL only? I am using ASP.NET Identity (Forms Authentication) in MVC 5.
Add some simple user and get users Password hash and security stamp, next use SQL query like this:
USE [Your database name]
GO
UPDATE [dbo].[Users]
SET [UserId] = <UserId, nvarchar(128),>
,[Email] = <Email, nvarchar(256),>
,[EmailConfirmed] = <EmailConfirmed, bit,>
,[PasswordHash] = <PasswordHash, nvarchar(max),> // Your password here
,[SecurityStamp] = <SecurityStamp, nvarchar(max),> // Security stamp here
,[PhoneNumber] = <PhoneNumber, nvarchar(max),>
,[PhoneNumberConfirmed] = <PhoneNumberConfirmed, bit,>
,[TwoFactorEnabled] = <TwoFactorEnabled, bit,>
,[LockoutEndDateUtc] = <LockoutEndDateUtc, datetime,>
,[LockoutEnabled] = <LockoutEnabled, bit,>
,[AccessFailedCount] = <AccessFailedCount, int,>
,[UserName] = <UserName, nvarchar(256),>
,[Discriminator] = <Discriminator, nvarchar(128),>
WHERE <Search Conditions,,> // here place Your user Id
GO
So your user password will be updated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With