示例#1
0
        /// <summary>
        ///     Send message to user and register message in system
        /// </summary>
        /// <param name="user"></param>
        /// <param name="email"></param>
        /// <returns></returns>
        public async Task InstatiateVerifierMessage(User user, string email)
        {
            int  userId = user.UserId;
            int  code   = codeGenerator.Generate();
            Guid guid   = Guid.NewGuid();
            // send code information
            await emailCodeSenderService.SendCodeByEmail(user, email, code, $"{guid}");

            // write storage
            await emailVerifierRepository.CreateEmailVerifier(userId, email, code, guid);
        }
示例#2
0
        // By email, send token and guid
        public async Task SendResetPasswordMail(string email)
        {
            // Prepare mail
            var    guid      = new Guid();
            string link      = $"{guid}";
            int    shortCode = generatorService.Generate();
            // configure mail
            var resetPasswordTemplate = new ResetPasswordTemplate();

            resetPasswordTemplate.Configure(shortCode, link);
            // send email
            await emailTemplateSender.SendMailAsync(email, resetPasswordTemplate);

            // save request
            await emailVerifierRepository.CreateEmailVerifier(0, email, shortCode, guid);
        }