public ActionResult Member_Reset(int id) { var query = entity.account_member.FirstOrDefault(p => p.id == id); query.password = DESTool.Encrypt("1"); return(Json(entity.SaveChanges() > 0, JsonRequestBehavior.AllowGet)); }
public ActionResult Register(string phone, string password, string code) { account_member member = entity.account_member.FirstOrDefault(p => p.phone == phone); if (member == null) { SMSTool tool = new SMSTool(); bool codeResult = tool.CheckCode(phone, code); if (codeResult == true) { account_member new_member = new account_member() { enable = true, password = DESTool.Encrypt(password), phone = phone, sys_datetime = DateTime.Now, }; entity.account_member.Add(new_member); if (entity.SaveChanges() > 0) { HttpContext.Session["tpmember"] = new_member; MessageTool.SendMessage(new_member.id, "系统通知", "恭喜您注册成功!"); return(Json(true, JsonRequestBehavior.AllowGet)); } return(Json("用户创建失败", JsonRequestBehavior.AllowGet)); } return(Json("验证码无效")); } return(Json("账号已被注册", JsonRequestBehavior.AllowGet)); }
public ActionResult Password_Add_Edit(string password) { int id = MemberManager.GetMember().id; account_member member = entity.account_member.FirstOrDefault(p => p.id == id); member.password = DESTool.Encrypt(password); return(Json(entity.SaveChanges() > 0, JsonRequestBehavior.AllowGet)); }
public ActionResult Login(string phone, string password) { account_admin admin = entity.account_admin.FirstOrDefault(p => p.phone == phone); if (admin != null && DESTool.Encrypt(password) == admin.password) { if (admin.enable == true) { HttpContext.Session["tpadmin"] = admin; return(Json(true, JsonRequestBehavior.AllowGet)); } else { return(Json("账号已被停用", JsonRequestBehavior.AllowGet)); } } return(Json("账号或密码错误", JsonRequestBehavior.AllowGet)); }
private void tb_jwPw_TextChanged(object sender, EventArgs e) { ini.Write(AppDirectory + @"\配置.ini", "主人信息", "教务系统密码", DESTool.Encrypt(tb_jwPw.Text, "jw*1")); }
public override int HandleImpl() { string msg = message.Replace(" ", ""); //去除空格 var StuID = textOp.GetMiddleText(msg, "绑定教务系统", "|"); var Password = textOp.GetRightText(msg, "|"); if (StuID == "" || Password == "") { CQ.Api.SendPrivateMessage(Convert.ToInt64(fromQQ), "命令格式错误,请检查输入信息。\n命令格式:绑定教务系统 学号|密码"); return(1); } EasLogin jwxt = new EasLogin(botQQ, fromQQ, StuID, Password, 3); string AppDirectory = CQ.Api.AppDirectory; for (int i = 0; i <= jwxt.TryNum; i++) { try { if (EasOP.StuExist(StuID) == false) { jwxt.LoginSys(); CQ.Api.SendPrivateMessage(Convert.ToInt64(fromQQ), "【登录成功】\n", jwxt.College, " ", jwxt.StuName); ini.Write(AppDirectory + @"\配置.ini", fromQQ, "学号", StuID); ini.Write(AppDirectory + @"\配置.ini", fromQQ, "密码", DESTool.Encrypt(Password, "jw*1")); EasGetCourse jwcourse = new EasGetCourse(); jwcourse.GetCourse(jwxt); EasGetScore jwScore = new EasGetScore(); jwScore.GetScore(jwxt); break; } else { CQ.Api.SendPrivateMessage(Convert.ToInt64(fromQQ), "【绑定失败】\n当前学号已被QQ:", EasOP.GetStuQQ(StuID), "绑定,不能再次绑定。"); } } catch (Exception ex) { if (ex.Message == "密码错误") { CQ.Api.SendPrivateMessage(Convert.ToInt64(fromQQ), "【用户名或密码错误】\n请确认无误后重新发送命令再试。"); } else if (ex.Message == "验证码错误") { if (i == jwxt.TryNum) { CQ.Api.SendPrivateMessage(Convert.ToInt64(fromQQ), "验证码错误已达最大尝试上限,如需继续登录可重新发送命令再试。"); } else { CQ.Api.SendPrivateMessage(Convert.ToInt64(fromQQ), "【验证码错误】\n正在重试。"); System.Threading.Thread.Sleep(1000); //休眠1s后重试请求 continue; } } else { CQ.Api.SendPrivateMessage(Convert.ToInt64(fromQQ), "发生未知错误,请联系机器人主人。"); CQ.Log.Error("发生未知错误", ex.ToString()); break; } } } return(0); }