Fix: CurrentUserId returned domain
This commit is contained in:
@@ -37,17 +37,26 @@ namespace Disco.Services.Users
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
string userId;
|
||||||
|
|
||||||
// Check for ASP.NET
|
// Check for ASP.NET
|
||||||
if (HttpContext.Current != null)
|
if (HttpContext.Current != null)
|
||||||
{
|
{
|
||||||
if (HttpContext.Current.Request.IsAuthenticated)
|
if (HttpContext.Current.Request.IsAuthenticated)
|
||||||
return HttpContext.Current.User.Identity.Name;
|
userId = HttpContext.Current.User.Identity.Name;
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// User default User
|
||||||
|
userId = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
|
||||||
|
}
|
||||||
|
|
||||||
// User default User
|
if (userId.Contains("\\"))
|
||||||
return System.Security.Principal.WindowsIdentity.GetCurrent().Name;
|
return userId.Substring(checked(userId.IndexOf("\\") + 1));
|
||||||
|
else
|
||||||
|
return userId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user