예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ProfileCommon loginProfile;
        String        result = "0"; // Return 0 if authentication failure

        // Arguments can be passed either by get or by post
        String username = Request["user"];
        String password = Request["pass"];

        // If valid, get the employee number and generate the random number
        if (Membership.ValidateUser(username, password))
        {
            // Get the Profile of the User
            loginProfile = (ProfileCommon)ProfileCommon.Create(username, true);

            result = AndroidAuthenticationController.GenerateAndroidSessionNumber(loginProfile.EmpNo).ToString();
        }

        Response.Write(result);
    }
예제 #2
0
    public WCFSessionID AuthenticateUser(String username, String password)
    {
        ProfileCommon loginProfile;
        WCFSessionID  result = new WCFSessionID()
        {
            SessionID = "0"
        };

        if (Membership.ValidateUser(username, password))
        {
            // Update the roles of the logged in user
            LoginController.setupRolesAfterAuthentication(username);

            // Get the Profile of the User
            loginProfile = (ProfileCommon)ProfileCommon.Create(username, true);

            result.SessionID = AndroidAuthenticationController.GenerateAndroidSessionNumber(loginProfile.EmpNo).ToString();
        }

        return(result);
    }