Beispiel #1
0
        public async Task <Result <string> > ValidateTokenAsync(string token)
        {
            if (string.IsNullOrEmpty(token))
            {
                return(Result.Fail <string>(EC.TokenInvalid, ET.TokenInvalid));
            }

            var model = _jwtTokenHelper.DecodeToken <EmailTokenModel>(token);
            var code  = await _securityCodeQueryRepository.GetSecurityCodeAsync((int)ProviderType.Email,
                                                                                (int)CodeActionType.ForgotPasswordByEmail, model.Email);

            if (code != model.Code)
            {
                return(Result.Fail <string>(EC.TokenInvalid, ET.TokenInvalid));
            }

            return(Result.OK(model.Email));
        }