private async Task <bool> ChangePassword()
        {
            try
            {
                var newPin  = _crypto.Encrypt(txtPin.Text);
                var request = new ResetPinRequest();
                request.Password = newPin;
                request.UserID   = Email;
                var response = await httpService.Post <ResetPinRequest>(request, "", URLConstants.SwitchApiBaseUrl, "Switch/ResetPin", "SetNewPinPage");

                if (response.IsSuccessStatusCode)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception CP)
            {
                await BusinessLogic.Log(CP.ToString(), "Exception changing PIN", string.Empty, string.Empty, string.Empty, string.Empty);

                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// Method to call Reset Pin Webservice
        /// </summary>
        private void ResetPinWebService()
        {
            string apiUrl    = RxConstants.resetPin;
            var    pinHashed = Utilities.GetSHA256(objResetPinLoginViewModel.DisplaySignUpPin);

            try
            {
                ResetPinRequest objInputParam = new ResetPinRequest
                {
                    mail             = objResetPinLoginViewModel.LoginEmail,
                    code             = objResetPinLoginViewModel.AuthCode,
                    pin              = pinHashed,
                    system_version   = "android",
                    app_version      = "1.6",
                    branding_version = "MLP"
                };

                WebClient resetpinswebservicecall = new WebClient();
                var       uri  = new Uri(apiUrl, UriKind.RelativeOrAbsolute);
                var       json = JsonHelper.Serialize(objInputParam);
                resetpinswebservicecall.Headers["Content-type"] = "application/json";
                resetpinswebservicecall.UploadStringCompleted  += resetpinswebservicecall_UploadStringCompleted;
                resetpinswebservicecall.UploadStringAsync(uri, "POST", json);
            }
            catch (Exception)
            {
                MessageBox.Show("Sorry, Unable to process your request.");
            }
        }