You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.5 KiB
32 lines
1.5 KiB
using CustomerOnlineV2.Common.Models.AccountModel;
|
|
using Microsoft.AspNetCore.Http;
|
|
using System.Security.Claims;
|
|
|
|
namespace CustomerOnlineV2.Common.Helper
|
|
{
|
|
public static class LoginUserInfo
|
|
{
|
|
public static LoginResponse GetLoginDetails(this HttpContext context)
|
|
{
|
|
var claimIdentity = context.User.Identity as ClaimsIdentity;
|
|
|
|
var model = new LoginResponse();
|
|
if (claimIdentity.IsAuthenticated)
|
|
{
|
|
model.UserName = claimIdentity.FindFirst(x => x.Type == "UserName").Value;
|
|
model.FullName = claimIdentity.FindFirst(x => x.Type == "FullName").Value;
|
|
model.ForceChangePassword = Convert.ToBoolean(claimIdentity.FindFirst(x => x.Type == "ForceChangePassword").Value);
|
|
//model.IsEmailVerified = Convert.ToBoolean(claimIdentity.FindFirst(x => x.Type == "IsEmailVerified").Value);
|
|
model.MobileNumber = claimIdentity.FindFirst(x => x.Type == "MobileNumber").Value;
|
|
model.MembershipId = claimIdentity.FindFirst(x => x.Type == "MembershipId").Value;
|
|
model.Email = claimIdentity.FindFirst(x => x.Type == "Email").Value;
|
|
model.RememberMe = Convert.ToBoolean(claimIdentity.FindFirst(x => x.Type == "RememberMe").Value);
|
|
model.SessionId = claimIdentity.FindFirst(x => x.Type == "SessionId").Value;
|
|
model.UserId = claimIdentity.FindFirst(x => x.Type == "UserId").Value;
|
|
|
|
|
|
}
|
|
return model;
|
|
}
|
|
}
|
|
}
|