namespace viviapi.WebUI
{
public partial class DoLogin : viviapi.BLL.Web.PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (_action == "login")
{
SignIn();
}
else
{
Response.Redirect(rUrl, true);
}
}
public string _action
{
get
{
return viviLib.Web.WebBase.GetFormString("__action", string.Empty);
}
}
string rUrl = "login.aspx";
void ShowErrorInfo(string error)
{
AlertAndRedirect(error,rUrl);
//corp_errtipDiv.Style.Add("display", "");
//corp_errtips.InnerHtml = error;
}
void SignIn()
{
string userName = Request.Form["inputuin"];
string userPwd = Request.Form["pp"];
string code = Request.Form["txtcheckCode"];
if (string.IsNullOrEmpty(code))
{
ShowErrorInfo("请输入验证码!");
return;
}
if (string.IsNullOrEmpty(userName))
{
ShowErrorInfo("请输入商户名!");
return;
}
if (string.IsNullOrEmpty(userPwd))
{
ShowErrorInfo("请输入商户密码!");
return;
}
if (this.Session["CCode"] == null)
{
ShowErrorInfo("验证码失效!请刷新页面");
return;
}
if (this.Session["CCode"].ToString().ToUpper() != code.ToUpper())
{
ShowErrorInfo("验证码不正确");
return;
}
UserInfo userInfo = new UserInfo();
userInfo.UserName = userName;
userInfo.Password = Cryptography.MD5(userPwd);
userInfo.LastLoginIp = viviLib.Web.ServerVariables.TrueIP;
userInfo.LastLoginTime = DateTime.Now;
userInfo.LastLoginAddress = viviapi.web.WebUtility.GetIPAddress(userInfo.LastLoginIp);
userInfo.LastLoginRemark = viviapi.web.WebUtility.GetIPAddressInfo(userInfo.LastLoginIp);
string msg = viviapi.BLL.User.UserFactory.SignIn(userInfo);
if (userInfo.ID > 0)
{
Response.Redirect("/Merchant/index.aspx", false);
}
else
{
AlertAndRedirect(msg);
}
}
}
}
namespace viviapi.WebUI { public partial class DoLogin : viviapi.BLL.Web.PageBase { protected void Page_Load(object sender, EventArgs e) { if (_action == "login") { SignIn(); } else { Response.Redirect(rUrl, true); } } public string _action { get { return viviLib.Web.WebBase.GetFormString("__action", string.Empty); } } string rUrl = "login.aspx"; void ShowErrorInfo(string error) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "messages", "<script>alert('登录错误!');location.href='login.sapx';</script>", false); //AlertAndRedirect(error,rUrl); //corp_errtipDiv.Style.Add("display", ""); //corp_errtips.InnerHtml = error; } void SignIn() { string userName = Request.Form["inputuin"]; string userPwd = Request.Form["pp"]; string code = Request.Form["txtcheckCode"]; if (string.IsNullOrEmpty(code)) { ShowErrorInfo("请输入验证码!"); return; } if (string.IsNullOrEmpty(userName)) { ShowErrorInfo("请输入商户名!"); return; } if (string.IsNullOrEmpty(userPwd)) { ShowErrorInfo("请输入商户密码!"); return; } if (this.Session["CCode"] == null) { ShowErrorInfo("验证码失效!请刷新页面"); return; } if (this.Session["CCode"].ToString().ToUpper() != code.ToUpper()) { ShowErrorInfo("验证码不正确"); return; } UserInfo userInfo = new UserInfo(); userInfo.UserName = userName; userInfo.Password = Cryptography.MD5(userPwd); userInfo.LastLoginIp = viviLib.Web.ServerVariables.TrueIP; userInfo.LastLoginTime = DateTime.Now; userInfo.LastLoginAddress = viviapi.web.WebUtility.GetIPAddress(userInfo.LastLoginIp); userInfo.LastLoginRemark = viviapi.web.WebUtility.GetIPAddressInfo(userInfo.LastLoginIp); string msg = viviapi.BLL.User.UserFactory.SignIn(userInfo); if (userInfo.ID > 0) { Response.Redirect("/Merchant/index.aspx", false); } else { AlertAndRedirect(msg); } } } }