public IEnumerator OnSendNewPassword(VOGController ctrl) { try { ctrl.DisableInput(); if (CurrentPasswordData == null || CurrentPasswordData.User == null) { ctrl.ShowMessageDialog("Doh!", "An error occurred during authentication. Please try again", () => { }); yield break; } ApiCall call = VostopiaClient.Authentication.BeginRecoverPassword(CurrentPasswordData.User.Username); IEnumerator e = call.Wait(); while (e.MoveNext()) { yield return e.Current; } if (VostopiaClient.Authentication.EndRecoverPassword(call)) { ctrl.ShowMessageDialog("Email Sent", "Alright! We've sent out your new password. Please check your email in a few minutes and return here to enter your password.", () => { }); } else { ctrl.ShowMessageDialog("Doh!", "An error occurred during sending recovery email. Please try again", () => { }); } } finally { ctrl.EnableInput(); } }
private IEnumerator Continue(VOGController ctrl) { try { ctrl.DisableInput(); //wait for connection while (!VostopiaClient.HasSessionKey) { yield return null; } //See if user exists ApiCall call = VostopiaClient.Authentication.BeginFindUser(Email); IEnumerator e = call.Wait(); while (e.MoveNext()) { yield return e.Current; } VostopiaUser user = VostopiaClient.Authentication.EndFindUser(call); if (user != null) { var passwordData = new VOGStateAuthPassword.PasswordData(); passwordData.CancelOnBack = false; passwordData.User = user; ctrl.StartTransition(PasswordState, passwordData); } else { if (!ValidateEmail(Email)) { ctrl.ShowMessageDialog("Oops!", "Please enter a valid email address.", () => { }); yield break; } else { ctrl.StartTransition(NewUserState, Email); } } } finally { ctrl.EnableInput(); } }