/// <summary> /// 验证登陆者的身份 /// </summary> /// <param name="adminMsg">管理员登录类</param> /// <param name="Message">信息提示</param> /// <param name="HasError">是否存在问题</param> public void ValidateCard(AdminMsg adminMsg, ref string Message, ref bool HasError) { //验证Token是否超时 if (adminMsg.Token.TokenFalseDate < DateTime.Now) { HasError = true; Message = "Token已超时失效,请重新登录!"; } //验证Token是正确 if (string.IsNullOrEmpty(adminMsg.AdminGuid)) { HasError = true; Message = "未传入有效Guid,请重新登录!"; } else { Token QueryToken = dv.ValidateToken(adminMsg.AdminGuid, adminMsg.SqlConn); if (QueryToken.TokenCode != adminMsg.Token.TokenCode) { HasError = true; Message = "错误的Token令牌,请重新登录!"; } else { HasError = false; Message = "恭喜,验证通过!"; } } }
public BAllotHandle(AdminMsg LoginMsg) { LocalUser = LoginMsg; DAllotHandle = new DAllotHandle(LoginMsg.SqlConn); DEmployee = new DEmployee(LoginMsg.SqlConn); DEFLog = new DEveryDayFinishiLog(LoginMsg.SqlConn); }
public FrmAddEmployee(AdminMsg LoginUser) { be = new BEmployee(LoginUser.SqlConn); SystemMsg = LoginUser; InitializeComponent(); BOperation = new BOperationRecord(LoginUser.SqlConn); log = new Log(PublicValues.LogFilePath); }
public FrmChangePass(AdminMsg LoginMsg) { InitializeComponent(); LoginInMsg = LoginMsg; bu = new B_User(LoginInMsg.SqlConn); BOperation = new BOperationRecord(LoginInMsg.SqlConn); log = new Log(PublicValues.LogFilePath); }
public FrmAllot(AdminMsg LoginUser) { InitializeComponent(); be = new BEmployee(LoginUser.SqlConn); LoginMsg = LoginUser; InitializeComponent(); BOperation = new BOperationRecord(LoginUser.SqlConn); BAllotHandle = new BAllotHandle(LoginUser); log = new Log(PublicValues.LogFilePath); }
private void BtnLogin_Click(object sender, EventArgs e) { string LoginCode = TbLoginCode.Text.Trim(); string YLoginPass = TbLoginPass.Text.Trim(); string LoginPass = sh.MD5Encrypt(TbLoginPass.Text.Trim(), Encoding.UTF8).ToLower(); string SignKey = TbSignKey.Text.Trim(); string InputPicCode = TbPicCode.Text.ToUpper(); //图形码验证 if (PicCode != InputPicCode) { Tips.TipsErrorBox("图形验证码输入错误!请重新输入"); RefrashImg(); return; } Msg msg = new Msg(); msg.Show(); //获取数据库连接串和验证登录身份 string WebResult = new GetSQLconnectioncs(LoginCode, LoginPass, SignKey).WebGetConnection(); JObject RJson = JsonConvert.DeserializeObject <JObject>(WebResult); string RCode = (string)RJson["Code"]; string SQLConnStr; if (RCode.Equals("00")) { AdminMsg SystemMsg = new AdminMsg(); //连接串 SQLConnStr = sh.AESDecrypt((string)RJson["SQLConn"], SignKey); //连接串传递 bu = new B_User(SQLConnStr); //获取登陆者的相关信息 SystemMsg = bu.GetAdminMsg(LoginCode, LoginPass); SystemMsg.SqlConn = SQLConnStr; //加载完成后隐藏加载中窗体 msg.Close(); /*友好的欢迎提示*/ string WelcomeStr = string.Format("亲爱的'{0}',欢迎您登录!", SystemMsg.AdminNickName); Tips.TipsInfoBox(WelcomeStr); this.Hide(); FrmMainConsole mainConsole = new FrmMainConsole(SystemMsg); mainConsole.ShowDialog(); this.Close(); } else { string ExcptionStr = (string)RJson["Msg"]; msg.Close(); /*错误日志记录*/ log.LogWrite("错误记录", "账号:" + LoginCode + "--" + ExcptionStr); Tips.TipsErrorBox(ExcptionStr); RefrashImg(); } }
/// <summary> /// 获取AdminMsg对象信息信息 /// </summary> /// <param name="code"></param> /// <param name="Pass"></param> /// <returns></returns> public Models.AdminMsg GetAdminMsg(string code, string Pass) { string IP = GetLocalIP(); Models.User user = this.GetUserInfo(code, Pass); AdminMsg msg = new AdminMsg(); msg.AdminGuid = user.UserGuid; msg.AdminLoginCode = user.UserCode; msg.AdminNickName = user.UserNickName; msg.AdminSex = user.UserSex; msg.Token = GetLoginToken(user.UserGuid, IP); msg.LoginTime = DateTime.Now; msg.LoginIP = IP; //用户行为记录 BOperation = new BOperationRecord(SqlConn); BOperation.RecordHandle(user.UserGuid, BOperationRecord.Level.Daily, string.Format("登入系统,IP:{0}", IP)); return(msg); }
public FrmOperationRecord(AdminMsg LoginMsg) { InitializeComponent(); BRecord = new BRecord(LoginMsg.SqlConn); TheUser = LoginMsg; }
public FrmMainConsole(AdminMsg msg) { InitializeComponent(); this.SystemMsg = msg; bEmployee = new BEmployee(msg.SqlConn); }