コード例 #1
0
ファイル: UserPL.cs プロジェクト: oolatunji/DL-Issuance
        public static UserDetails AuthenticateUser(string username, string password)
        {
            try
            {
                var userObj = new UserDetails();
                var user    = UserDL.AuthenticateUser(username, password);
                if (user != null)
                {
                    var userFunctions = new List <FunctionModel>();

                    foreach (RoleFunction roleFunction in user.Role.RoleFunctions)
                    {
                        var function = new FunctionModel
                        {
                            Name     = roleFunction.Function.Name,
                            PageLink = roleFunction.Function.PageLink
                        };

                        userFunctions.Add(function);
                    }

                    userObj.ID       = user.ID;
                    userObj.Username = user.Username;
                    userObj.Role     = user.Role.Name;
                    userObj.Function = userFunctions;
                }
                return(userObj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
ファイル: UserPL.cs プロジェクト: oolatunji/DL-Issuance
        public static bool UserExists(string username, string password)
        {
            try
            {
                var user = new User();

                user = UserDL.AuthenticateUser(username, PasswordHash.MD5Hash(password));

                if (user == null)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }