Exemplo n.º 1
0
    public User selectUser(User u)
    {
        // use the FormsAuth HashPwd method to turn the string into an md5 hash.
        u.password = FormsAuthentication.HashPasswordForStoringInConfigFile(u.password, "MD5");

        var result = DALuser.selectUser(u);

        if (result == null)
        {
            // if no user was found, throw new exception and end the login process
            throw new Exception("It appears your credentials were not correct. Please try again.");
        }
        else
        {
            // otherwise return the user
            return(result);
        }
    }