public async Task <ResultWrapper <SendVerificationEmailOutput> > Handle(SendVerificationEmailCommand request, CancellationToken cancellationToken)
        {
            ResultWrapper <SendVerificationEmailOutput> verificationResult = new ResultWrapper <SendVerificationEmailOutput>();
            SendVerificationEmailRequest verificationReq = new SendVerificationEmailRequest()
            {
                requestType = FireBaseRequestEnum.VERIFY_EMAIL.ToString(),
                idToken     = request.idToken
            };
            ResultWrapper <SendVerificationEmailResponse> verificationEmailResult = await _fireBaseTool.SendEmailVerification(verificationReq);

            if (!verificationEmailResult.Status)
            {
                verificationResult.Status  = false;
                verificationResult.Message = verificationEmailResult.Message;
                return(verificationResult);
            }
            verificationResult.Status = true;
            verificationResult.Result = new SendVerificationEmailOutput()
            {
                Email = verificationEmailResult.Result.email,
            };

            return(verificationResult);
        }
Esempio n. 2
0
        public async Task <ResultWrapper <SendVerificationEmailResponse> > SendEmailVerification(SendVerificationEmailRequest request)
        {
            ResultWrapper <SendVerificationEmailResponse> result = new ResultWrapper <SendVerificationEmailResponse>()
            {
                Result = new SendVerificationEmailResponse()
            };

            HttpContent content = new StringContent(JsonConvert.SerializeObject(request), System.Text.Encoding.UTF8, "application/json");;
            string      action  = SendVerificationEmail_URL.Replace("API_KEY", _appSettings.FireBase.ApiKey);

            HttpResponseMessage response = await _httpClient.PostAsync(BASE_URL + action, content);

            string strResponse = await response.Content.ReadAsStringAsync();

            result.Result = JsonConvert.DeserializeObject <SendVerificationEmailResponse>(strResponse);
            result.Status = !string.IsNullOrEmpty(result.Result.email);
            if (!result.Status)
            {
                result.Message = result.Result.error.message;
            }
            return(result);
        }
Esempio n. 3
0
        public void SendVerificationEmail(SendVerificationEmailRequest request)
        {
            var user = userSecurityRepository.GetByEmail(request.Email);

            SendVerificationEmail(user);
        }