/// <summary> /// Resends a confirmation email to the user. /// <para>NOTE: This only works for user's created with CustomAuthentication.</para> /// </summary> /// <param name="cb">The result of the web request.</param> public void ResendVerificationEmail(ResendEmailCallback cb) { 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("UserID", userID.ToString(CultureInfo.InvariantCulture)); formData.Add("SessionToken", sessionToken); m_WebCoroutine = m_CoroutineOwner.StartCoroutine(OnResendEmailResponse(m_AppService.apiUrl + "verification/resend_email.php", formData, cb)); }
private IEnumerator OnResendEmailResponse(string url, Dictionary <string, string> formData, ResendEmailCallback 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(ResendEmailResponseCode.Error, error); yield break; } JsonResponse response = JsonResponse.FromJson(request.downloadHandler.text); ResendEmailResponseCode code = (ResendEmailResponseCode)response.code; switch (response.code) { case 1: cb?.Invoke(code, null); break; case 2: cb?.Invoke(code, new ErrorResponse("Email already verified.", response.message, null, response.code)); break; default: cb?.Invoke(code, WebConfig.GetUnknownError(request)); break; } } }