Change Forms User's Username to User Email

To change forms user's username to user email you have to run the provided sql script:

USE [TeamPulse]
GO
    
DECLARE @Username NVARCHAR(256) = 'testuser' /* CHANGE THIS to the UserName (from the User table) of the user that
the username is being changed */

DECLARE @UserID UNIQUEIDENTIFIER
DECLARE @UserEmail NVARCHAR(256)

/* Get the current user's information */
SELECT @UserID = u.StsUserID, @UserEmail = Email
FROM [TeamPulse].[dbo].[User] u
WHERE u.Username = @Username

/* Modify user in User table */
UPDATE [User]
SET Username = @UserEmail
WHERE StsUserID = @UserID

/* Modify user in aspnet_Users table */
UPDATE [aspnet_Users]
SET UserName = @UserEmail
,LoweredUserName = LOWER(@UserEmail)
WHERE UserId = @UserID

/* Modify notification rules in RuleItem table */
UPDATE [RuleItem]
SET Value = @UserEmail
WHERE Value = @Username