示例#1
0
        /// <summary>
        /// reset password when you forget your old password
        /// </summary>
        /// <param name="email">your email</param>
        /// <param name="countryCode">country code</param>
        /// <returns></returns>
        public async Task <PasswordResetEnum> ResetPassword(string email, string countryCode)
        {
            PasswordResetEnum passwordResetStatus = PasswordResetEnum.ResetFailure;

            try
            {
                if (!ValidateHelper.IsEmail(email))
                {
                    return(PasswordResetEnum.InvalidEmail);
                }
                if (string.IsNullOrEmpty(countryCode))
                {
                    return(PasswordResetEnum.SelectCountry);
                }
                var pingResult = await connectionMonitor.PingService(countryCode);

                if (!pingResult)
                {
                    passwordResetStatus = PasswordResetEnum.NetDisconnected;
                }
                else
                {
                    passwordResetStatus = await loginDomainService.ResetPassword(email, countryCode);
                }
            }
            catch (Exception ex)
            {
                Logger.Log("ResetPassword" + ex.ToString());
            }
            return(passwordResetStatus);
        }
示例#2
0
        public static void RunResetPasswordAlert(NSWindow parentWindow, PasswordResetEnum resetResponse)
        {
            string errorMsg = "";
            string title;

            switch (resetResponse)
            {
            case PasswordResetEnum.NetDisconnected:
                title     = "Server Error";
                errorMsg += "Unable to communicate with LexisNexis Red services. Please ensure you have an internet connection, or try again later as the servers may be busy.";
                break;

            case PasswordResetEnum.EmailNotExist:
            case PasswordResetEnum.InvalidEmail:
                title     = "Error";
                errorMsg += "The email address you entered does not look correct. Please enter valid email address!";
                break;

            case PasswordResetEnum.ResetSuccess:
                title     = "";
                errorMsg += "Your password reset request has been sent.";
                break;

            case PasswordResetEnum.ResetFailure:
                title     = "Error";
                errorMsg += "Login failed, unknow error!";
                break;

            case PasswordResetEnum.SelectCountry:
                title     = "Error";
                errorMsg += "Please select a country from the drop down list.";
                break;

            case PasswordResetEnum.DeviceIdNotMatched:
                title     = "Error";
                errorMsg += "Device ID is not mapped to the email address provided.";                 //Device ID is not mapped to the email address provided.
                break;

            default:
                title     = "Error";
                errorMsg += "Login failed, unknow error!";
                break;
            }

            if (errorMsg != "")
            {
                NSAlert alert = NSAlert.WithMessage(title, "OK", null, null, errorMsg);
                alert.Window.MakeFirstResponder(null);
                alert.RunSheetModal(parentWindow);
            }
        }
示例#3
0
        async partial void SendButtonClick(NSObject sender)
        {
            SetControlsState(false);
            LoginUser user = new LoginUser();

            user.Email = EmailTF.StringValue;

            List <Country> regions = ConfigurationService.GetAllCountryMap();

            foreach (Country region in regions)
            {
                if (region.CountryName.Equals(CountryCombobox.StringValue))
                {
                    user.CountryCode = region.CountryCode;
                    break;
                }
            }

            PasswordResetEnum resetResponse = await ResetPassword(user);

            if (IsRequestCancel)
            {
                IsRequestCancel = false;
                return;
            }

            SetControlsState(true);

            AlertSheet.RunResetPasswordAlert(Window, resetResponse);

            if (resetResponse == PasswordResetEnum.ResetSuccess)
            {
                IsResetSuccess = true;
                Window.OrderOut(null);
                Window.Close();
            }
            else
            {
                IsResetSuccess = false;
            }
        }
示例#4
0
        private void ProcessResetPasswordResult(PasswordResetEnum result)
        {
            switch (result)
            {
            case PasswordResetEnum.EmailNotExist:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ReminderPasswordErrorTitle,
                    Resource.String.ReminderPasswordError);
                break;
            }

            case PasswordResetEnum.ResetSuccess:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ReminderPasswordTitle,
                    Resource.String.ReminderPasswordSucceed,
                    0,
                    -1,
                    ReminderPasswordSucceedDialog
                    );
                break;
            }

            case PasswordResetEnum.InvalidEmail:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ReminderPassword_ErrorTitleErrorMessage,
                    Resource.String.ReminderPassword_InvalidEmail);
                break;
            }

            case PasswordResetEnum.DeviceIdNotMatched:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ReminderPasswordErrorTitle,
                    Resource.String.ReminderPassword_DeviceIdNotMatched);
                break;
            }

            case PasswordResetEnum.SelectCountry:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ReminderPasswordErrorTitle,
                    Resource.String.LoginErrorMessage_SelectCountry);
                break;
            }

            case PasswordResetEnum.NetDisconnected:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ReminderPasswordErrorTitle,
                    Resource.String.LoginErrorMessage_NetDisconnected);
                break;
            }

            case PasswordResetEnum.ResetFailure:
            {
                DialogGenerator.ShowMessageDialog(
                    FragmentManager,
                    Resource.String.ReminderPasswordErrorTitle,
                    Resource.String.ReminderPassword_ResetFailure);
                break;
            }
            }

            return;
        }