示例#1
0
        public async Task <Result <string> > CreateCode(string username)
        {
            var user = await userService.GetUser(username);

            if (user == null)
            {
                return(UserNotFound);
            }

            var code        = GenerateCode();
            var sendSuccess = smsService.Send(user.Phone, code);

            if (sendSuccess != SmsResult.OK)
            {
                return(FailedToSendSms);
            }

            await verificationService.Create(username, code);

            return(code);
        }