Exemplo n.º 1
0
        async public Task <bool> VerifyUser(string secret, VerificationType verificationType)
        {
            if (string.IsNullOrEmpty(secret))
            {
                await InvalidSecretErrorAsync(verificationType);

                return(false);
            }

            if (verificationType == VerificationType.OTP)
            {
                var request = new VerifyOTPRequest(secret);
                try
                {
                    await _apiService.PostAccountVerifyOTPAsync(request);
                }
                catch
                {
                    await InvalidSecretErrorAsync(verificationType);

                    return(false);
                }
            }
            else
            {
                var passwordValid = await _cryptoService.CompareAndUpdateKeyHashAsync(secret, null);

                if (!passwordValid)
                {
                    await InvalidSecretErrorAsync(verificationType);

                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
 public Task PostAccountVerifyOTPAsync(VerifyOTPRequest request)
 {
     return(SendAsync <VerifyOTPRequest, object>(HttpMethod.Post, "/accounts/verify-otp", request,
                                                 true, false));
 }