/// <summary>
        /// Sends a password reset to the specified email address. Email address must be on file.
        /// <para>NOTE: User does not need to be logged in to perform this action.</para>
        /// </summary>
        /// <param name="cb">The result of the web request.</param>
        /// <param name="email">The email of the account to reset.</param>
        public void RequestPasswordReset(ResetPasswordCallback cb, string email)
        {
            if (m_WebCoroutine != null)
            {
                Debug.LogError("A request is already in progress. Please wait for the operation to complete.");
                return;
            }

            Dictionary <string, string> formData = new Dictionary <string, string>();

            formData.Add("Email", email);

            m_WebCoroutine = m_CoroutineOwner.StartCoroutine(OnPasswordRequestResponse(m_AppService.apiUrl + "reset/request_password_reset.php", formData, cb));
        }
        private IEnumerator OnPasswordRequestResponse(string url, Dictionary <string, string> formData, ResetPasswordCallback cb)
        {
            using (UnityWebRequest request = WebConfig.Post(url, formData))
            {
                yield return(request.SendWebRequest());

                m_WebCoroutine = null;

                ErrorResponse error = WebConfig.ProcessGenericErrors(request);

                if (error != null)
                {
                    cb?.Invoke(new ResetPasswordResponse(), error);
                    yield break;
                }

                ResetPasswordResponse response = ResetPasswordResponse.FromJson(request.downloadHandler.text);

                switch (response.code)
                {
                case 1:
                    cb?.Invoke(response, null);
                    break;

                case 2:
                    cb?.Invoke(response, new ErrorResponse("The email entered is not valid.", response.message, null, response.code));
                    break;

                case 3:
                    string time = DateUtility.GetFormattedTimeFromSeconds(response.timeSinceLastEmail);
                    cb?.Invoke(response, new ErrorResponse("Reset limit reached.\n\nTry again in " + time + ".", response.message, null, response.code));
                    break;

                default:
                    // Unknown code error
                    cb?.Invoke(response, WebConfig.GetUnknownError(request));
                    break;
                }
            }
        }