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);
}
}

 

上一篇:centos7安装gitlab


下一篇:ruby-on-rails-POST请求神秘地变成GET请求