12月2号

一.手机号登录点击事件

if (Page.IsValid)
{
var result = AccountManager.LoginByUserName(txtMobileNumber.Text, txtPassword.Text);
if (result.StatusCode == Common.StatusCode.Succeed)
{
var user = result.ReadResult();
IdentityManager.SaveUser(user);
var url = Request.QueryString["ReturnUrl"];
if (!string.IsNullOrWhiteSpace(url))
{
Response.Redirect(url);
}
else
{
Response.Redirect("Default.aspx");
}
}
else
{
//Response.Write()
ClientScript.RegisterStartupScript(GetType(), "loginerror", $"alert('{result.Message}')", true);
}
}

二.用户名密码登录点击事件

if (Page.IsValid)
{
var result = AccountManager.LoginByUserName(txtMobileNumber.Text, txtPassword.Text);
if (result.StatusCode == Common.StatusCode.Succeed)
{
var user = result.ReadResult();
IdentityManager.SaveUser(user);
var url = Request.QueryString["ReturnUrl"];
if (!string.IsNullOrWhiteSpace(url))
{
Response.Redirect(url);
}
else
{
Response.Redirect("Default.aspx");
}
}
else
{
//Response.Write()
ClientScript.RegisterStartupScript(GetType(), "loginerror", $"alert('{result.Message}')", true);
}
}

 

posted @ 2021-12-02 21:52  Luckyyi  阅读(55)  评论(0编辑  收藏  举报