public UserPrincipal(int userID,string cnKey) { Js.DAO.Account.UserDao user1 = new Js.DAO.Account.UserDao(cnKey); this.identity = new SiteIdentity(userID, cnKey); this.permissionListid = user1.GetEffectivePermissionListID(userID, ((SiteIdentity)this.identity).UserName); this.roleList = user1.GetUserRoles(userID); this.permission = user1.GetUserPermission(userID, ((SiteIdentity)this.identity).UserName); this.rolepermission = user1.GetUserRolePermission(userID, ((SiteIdentity)this.identity).UserName); this.userpermission = user1.GetPermission(userID); }
public static UserPrincipal ValidateLogin(string userName, string password,string cnKey) { byte[] buffer1 = UserPrincipal.EncryptPassword(password); byte[] buffer2 = UserPrincipal.EncryptPassword("admin"); Js.DAO.Account.UserDao user1 = new Js.DAO.Account.UserDao(cnKey); int num1 = user1.ValidateLogin(userName, buffer1, buffer2); if (num1 > 0) { return new UserPrincipal(num1, cnKey); } return null; }
public int TestPassword(string password, string cnKey) { byte[] buffer1 = new UnicodeEncoding().GetBytes(password); byte[] buffer2 = new SHA1CryptoServiceProvider().ComputeHash(buffer1); Js.DAO.Account.UserDao user1 = new Js.DAO.Account.UserDao(cnKey); return user1.TestPassword(this.model.UserID, buffer2); }