Exemplo n.º 1
0
        public async Task <IDataResult <AccessToken> > Verify(VerifyOTPCommand request)
        {
            var login = await logins.GetAsync(m => m.Code == request.Code && m.ExternalUserId == request.ExternalUserId && m.SendDate.AddHours(24) > DateTime.Now);

            if (login == null)
            {
                return(new ErrorDataResult <AccessToken>(Messages.InvalidCode));
            }
            var accessToken = await CreateToken(login.ExternalUserId);

            login.IsUsed = true;
            logins.Update(login);
            await logins.SaveChangesAsync();


            return(new SuccessDataResult <AccessToken>(accessToken, Messages.SuccessfulLogin));
        }
Exemplo n.º 2
0
 public Task <IDataResult <AccessToken> > Verify(VerifyOTPCommand request)
 {
     throw new NotImplementedException();
 }