public bool VerifyChange(int uid, string password, string passwordNew) { return(Change(uid, passwordNew, passwordDb => { password = YoConvert.ToMD5(password); return password == passwordDb; })); }
public bool Add(sys_user row) { if (!check(row)) { return(false); } row.password = YoConvert.ToMD5(row.password); return(AddRow(row)); }
public bool ChangePassword(sys_user row, string passwordNew) { row.password = passwordNew; if (!check(row)) { return(false); } row.password = YoConvert.ToMD5(row.password); return(ModifyRow(row)); }
public bool Login(string uname, string password) { bool result = false; while (true) { // get user object obj = uname; if (YoConvert.ToInt(ref obj)) { m_userModel.FindMobile(uname); } else { m_userModel.FindUname(uname); } var user = m_userModel.Row; if (user == null) { m_errorDict[SYS] = "no user"; break; } password = YoConvert.ToMD5(password); if (user.password != password) { m_errorDict[SYS] = "wrong password"; break; } // get token if (m_tokenModel.FindUid(user.id)) { result = m_tokenModel.Update(m_tokenModel.Row); break; } var token = new sys_token(); token.ticket = YoConvert.ToMD5(user.id + "_" + DateTime.Now); token.uid = user.id; result = m_tokenModel.Add(token); break; } return(result); }