Beispiel #1
0
 void HandleOnLoginSuccess(string message)
 {
     SaveLoginPathway();
     PlayFabLoginCalls.RequestSpinner();
     PlayFabLoginCalls.GetAccountInfo();
     this.activeState = LoginStates.LoggedIn;
 }
Beispiel #2
0
 public User(Membership membershipService)
 {
     _membershipService = membershipService;
     _id          = -1;
     _name        = "Unknown User";
     _loginStatus = LoginStates.NeverSignedIn;
     //_membershipService = new Membership();
     //Permissions = new List<Permission>();
 }
Beispiel #3
0
 void HandleOnLoginFail(string message)
 {
     if (message == "Logout")
     {
         this.GetComponent <Image>().enabled = true;
         bottomMenu.EnableUI();
         SaveUserAccountInfo();
         SaveLoginPathway();
     }
     this.activeState = LoginStates.Manual;
 }
Beispiel #4
0
        public override void Read(byte[] array)
        {
            McVarint.TryParse(ref array, out ProtocolVersion);

            McString.TryParse(ref array, out Address);

            McUnsignedShort.TryParse(ref array, out Port);

            McVarint.TryParse(ref array, out int loginState);
            LoginState = (LoginStates)loginState;
        }
Beispiel #5
0
 // Use this for initialization
 void Start()
 {
     if (!string.IsNullOrEmpty(this.PlayFabTitleId) && string.IsNullOrEmpty(PlayFab.PlayFabSettings.TitleId))
     {
         PlayFab.PlayFabSettings.TitleId = this.PlayFabTitleId;
         this.activeState = LoginStates.Auto;
     }
     else if (string.IsNullOrEmpty(PlayFab.PlayFabSettings.TitleId))
     {
         Debug.Log("PlayFab Title Id Required. Please enter your Id on the Authentication Controller");
     }
 }
 public AwfulAuthenticator()
 {
     browser.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
     browser.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
     browser.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(OnBrowserNavigationFailed);
     browser.Navigating += new EventHandler<NavigatingEventArgs>(OnBrowserNavigating);
     browser.Navigated += new EventHandler<System.Windows.Navigation.NavigationEventArgs>(OnBrowserNavigated);
     browser.IsScriptEnabled = true;
     browser.ScriptNotify += new EventHandler<NotifyEventArgs>(OnBrowserScriptNotify);
     this._currentState = LoginStates.READY;
     this._status = string.Empty;
     this.IsLoading = false;
 }
Beispiel #7
0
    public void Start()
    {
        state = LoginStates.LoggingIn;
        if (string.IsNullOrEmpty(PlayFabSettings.TitleId))
        {
            PlayFabSettings.TitleId = "917FC";
        }

        LoginWithCustomIDRequest request = new LoginWithCustomIDRequest()
        {
            CustomId = PlayerGUID, CreateAccount = true
        };

        PlayFabClientAPI.LoginWithCustomID(request, OnLoginSuccess, OnLoginFailure);
    }
Beispiel #8
0
    public void ChangeState(LoginStates state)
    {
        Debug.Log(string.Format("Changing State to: {0}", state.ToString()));
        switch (state)
        {
        case LoginStates.Manual:
            manualLogin.EnableUI();
            autoLogin.DisableUI();
            registerLogin.DisableUI();
            break;

        case LoginStates.Register:
            manualLogin.DisableUI();
            autoLogin.DisableUI();
            registerLogin.EnableUI();
            break;

        case LoginStates.Auto:
            manualLogin.DisableUI();
            autoLogin.EnableUI();
            registerLogin.DisableUI();
            break;

        case LoginStates.LoggedIn:
            manualLogin.DisableUI();
            autoLogin.DisableUI();
            registerLogin.DisableUI();
            bottomMenu.DisableUI();
            this.GetComponent <Image>().enabled = false;
            break;
        }

        this.previousFrameState = this.activeState;

        if (LoginStateChange != null)
        {
            LoginStateChange(state);
        }
    }
    public void ChangeState(LoginStates state)
    {
        Debug.Log(string.Format("Changing State to: {0}", state.ToString()));
        switch(state)
        {
            case LoginStates.Manual:
                manualLogin.EnableUI();
                autoLogin.DisableUI();
                registerLogin.DisableUI();
            break;

            case LoginStates.Register:
                manualLogin.DisableUI();
                autoLogin.DisableUI();
                registerLogin.EnableUI();
            break;

            case LoginStates.Auto:
                manualLogin.DisableUI();
                autoLogin.EnableUI();
                registerLogin.DisableUI();
            break;

            case LoginStates.LoggedIn:
                manualLogin.DisableUI();
                autoLogin.DisableUI();
                registerLogin.DisableUI();
                bottomMenu.DisableUI();
                this.GetComponent<Image>().enabled = false;
            break;
        }

        this.previousFrameState = this.activeState;

        if(LoginStateChange != null)
            LoginStateChange(state);
    }
 // Use this for initialization
 void Start()
 {
     if(!string.IsNullOrEmpty(this.PlayFabTitleId) && string.IsNullOrEmpty(PlayFab.PlayFabSettings.TitleId))
     {
         PlayFab.PlayFabSettings.TitleId = this.PlayFabTitleId;
         this.activeState = LoginStates.Auto;
     }
     else if(string.IsNullOrEmpty(PlayFab.PlayFabSettings.TitleId))
     {
         Debug.Log ("PlayFab Title Id Required. Please enter your Id on the Authentication Controller");
     }
 }
 void HandleOnLoginSuccess(string message)
 {
     SaveLoginPathway();
     PlayFabLoginCalls.RequestSpinner();
     PlayFabLoginCalls.GetAccountInfo();
     this.activeState = LoginStates.LoggedIn;
 }
 void HandleOnLoginFail(string message)
 {
     if(message == "Logout")
     {
         this.GetComponent<Image>().enabled = true;
         bottomMenu.EnableUI();
         SaveUserAccountInfo();
         SaveLoginPathway();
     }
     this.activeState = LoginStates.Manual;
 }
Beispiel #13
0
 private void OnLoginFailure(PlayFabError error)
 {
     state = LoginStates.Failed;
     Debug.Log("Unable to log into Playfab Services");
 }
Beispiel #14
0
 private void OnLoginSuccess(LoginResult result)
 {
     state = LoginStates.Success;
     //Debug.Log("Login Success: " + result.InfoResultPayload.AccountInfo.Username);
     Debug.Log("Test");
 }
 private void ReportLoginPageInaccessible()
 {
     this.IsLoading = false;
     this.Status = string.Empty;
     this._currentState = LoginStates.READY;
     this.Result.Fire(this, new ValueChangedEventArgs<LoginResult>(LoginResult.CANNOT_REACH_LOGIN_PAGE));
 }
        private void AddUsernameAndPassword()
        {
            // use javascript to fill in username and password input fields, then submit
            string usernameScript = string.Format("$('input[name=\"username\"]').val('{0}')", this.Username);
            string passwordScript = string.Format("$('input[name=\"password\"]').val('{0}')", this.Password);

            Logger.AddEntry(usernameScript);
            Logger.AddEntry(passwordScript);

            // run script
            this._currentState = LoginStates.AUTHENTICATING;
            browser.InvokeScript("eval", usernameScript);
            browser.InvokeScript("eval", passwordScript);
            this.SubmitAndProcess();
        }
        public void LoginAsync()
        {
            this.Status = string.Empty;
            this._currentState = LoginStates.NON_BROWSER_LOGIN;
            switch (this._currentState)
            {
                // if we aren't logged in and just getting started
                case LoginStates.READY:
                    this.IsLoading = true;
                    browser.Navigate(new Uri(READY_URL));
                    break;

                // if we failed earlier, we can assume we're on a page where we can login
                case LoginStates.FAILED:
                    this.RunLoginScript();
                    break;

                case LoginStates.NON_BROWSER_LOGIN:
                    this.NonBrowserLoginAsync();
                    break;
            }
        }
        public void ManualLoginAsync()
        {
            this.Status = string.Empty;
            this._currentState = LoginStates.AUTO_LOGIN;

            switch(this._currentState)
            {
                case LoginStates.SUBMITTING_MANUALLY:
                    browser.Navigate(new Uri(READY_URL));
                    break;

                case LoginStates.AUTO_LOGIN:
                    this.NonBrowserLoginAsync();
                    break;
            }
        }
        private void RunLoginScript()
        {
            this.IsLoading = true;

            Action failAfterTimeout = () =>
                {
                    if (this._currentState == LoginStates.AUTHENTICATING)
                    {
                        this._currentState = LoginStates.FAILED;
                        this.ReportLoginPageInaccessible();
                    }
                };

            try
            {
                new Action(this.AddUsernameAndPassword).DelayThenInvoke(new TimeSpan(0, 0, 3));
            }
            catch (Exception ex)
            {
                Logger.AddEntry(ex);
                this.ReportLoginFailed();
                //new Action(this.AddUsernameAndPassword).DelayThenInvoke(new TimeSpan(0, 0, 1));
            }
        }
        private void ReportLoginSuccess()
        {
            this.Status = "Success! Welcome to the forums.";
            this.IsLoading = false;
            List<Cookie> cookies = null;
            bool cookiesGrabbed = false;
            int attempts = 0;
            while (!cookiesGrabbed && attempts < MAX_LOGIN_ATTEMPTS)
            {
                // try to get the cookies from the browser. browser.GetCookies() throws an
                // index out of range exception often...
                try
                {

                    cookies = this.ManageCookies(browser.GetCookies());
                    cookiesGrabbed = true;
                }
                catch (Exception ex)
                {
                    Logger.AddEntry("An error occurred: ", ex);
                    attempts = attempts + 1;
                }
            }

            //  try to parse username from index //
            var web = new WebGet();
            web.LoadAsync(SUCCESS_URL, (a, args) =>
                {
                    if (a == ActionResult.Success)
                    {
                        string username = AwfulIndexParser.ParseUserSessionName(args.Document);
                        this.Username = username;
                        this._currentState = LoginStates.SUCCESS;
                        this.Result.Fire(this, new ValueChangedEventArgs<LoginResult>(LoginResult.LOGIN_SUCCESSFUL));
                        var profile = new AwfulProfile() { Username = this.Username, Password = this.Password };
                        LoginSuccessful.Fire(this, new ProfileChangedEventArgs(profile, cookies));
                    }
                });

            this.Status = "Grabbing username...";
        }
        public void NonBrowserLoginAsync()
        {
            this.IsLoading = true;
            this.Status = "contacting forum servers...";
            var request = AwfulWebRequest.CreatePostRequest("http://forums.somethingawful.com/account.php?");
            request.BeginGetRequestStream(callback => ProcessNonBrowserLoginRequest(callback,
                success =>
                {
                    if (success)
                    {
                        this.Status = "login successful!";
                        Logger.AddEntry(this.Status);
                        this._currentState = LoginStates.SUCCESS;
                        this.Result.Fire(this, new ValueChangedEventArgs<LoginResult>(LoginResult.LOGIN_SUCCESSFUL));
                        var profile = new AwfulProfile() { Username = this.Username, Password = this.Password };
                        LoginSuccessful.Fire(this, new ProfileChangedEventArgs(profile, this.AuthenticationCookies));
                    }

                    else { this.ReportLoginFailed(); }
                    this.IsLoading = false;
                }),
                request);
        }
 private void ReportLoginFailed()
 {
     this.IsLoading = false;
     this.Status = "Login failed.";
     this._currentState = LoginStates.FAILED;
     this.Result.Fire(this, new ValueChangedEventArgs<LoginResult>(LoginResult.LOGIN_FAILED));
 }