コード例 #1
0
        public async Task SendMailVerificationCode(string mailAddress)
        {
            var code = VerificationCodeGenerater.GenerateCode();
            Expression <Func <Task> > expression = () => _emailSender.SendMessage(mailAddress, L("VerificationSubject"), string.Format(L("VerificationBody"), code));

            Hangfire.BackgroundJob.Schedule(expression, TimeSpan.Zero);
            await _messageHistoryRepository.InsertAsync(new MessageHistory { Code = code, Type = MessageType.Mail, Message = string.Format(L("VerificationBody"), code), To = mailAddress });
        }
コード例 #2
0
        public async Task SendSmsVerificationCode(string phoneNumber)
        {
            var code      = VerificationCodeGenerater.GenerateCode();
            var smsParams = new Dictionary <string, string>()
            {
                { "code", code }
            };
            Expression <Func <Task> > expression = () => _smsMessage.SendMessage(phoneNumber, "", smsParams);

            Hangfire.BackgroundJob.Schedule(expression, TimeSpan.Zero);
            await _messageHistoryRepository.InsertAsync(new MessageHistory { Code = code, Type = MessageType.Sms, Message = code, To = phoneNumber });
        }
コード例 #3
0
 public Task <bool> Verify(string code)
 {
     return(new ValueTask <bool>(VerificationCodeGenerater.Verify(code)).AsTask());
 }