我需要在Identity Server自定义登录页面的“用户名”字段中填充当前用户名

问题描述 投票:-2回答:1

在下面的Identity Server 3链接中,我必须填写用户名和密码才能登录。

https://github.com/IdentityServer/IdentityServer3/blob/master/source/Core/Services/DefaultViewService/PageAssets/login.html

但是,我需要的是,在使用Window的系统用户名在屏幕上闪烁登录页面之前,应该自动填充用户名。为此,我尝试了以下我在此处提出的以及对此问题的回答:

但这只适用于Internet Explorer,因为它只有Internet Explorer支持的ActiveX。我需要以某种方式传递(System.Environment.Username)< - 给我当前用户,我需要传递到登录页面

c# html identityserver3
1个回答
0
投票
<script>
function GetUsername()
{
var wshshell = new ActiveXObject("wscript.shell");
                var username = wshshell.ExpandEnvironmentStrings("%username%");
                document.getElementById("username").value  = username;
}
</script>

I called this method from <body lang="en" onload="GetUserName()">  but this only gives current username in Internet explorer. Please someone suggest me better answer if they have any idea.
© www.soinside.com 2019 - 2024. All rights reserved.