예제 #1
0
        /// <summary>
        /// 重设密码Email验证
        /// </summary>
        /// <param name="email">邮箱</param>
        /// <param name="code">验证码</param>
        /// <returns></returns>
        public async Task<bool> ResetPasswordConfirmEmailAsync(string email, string code)
        {
            using (KoalaBlogDbContext dbContext = new KoalaBlogDbContext())
            {
                EmailConfirmationHandler emailConfirmationHandler = new EmailConfirmationHandler(dbContext);

                return await emailConfirmationHandler.ResetPasswordConfirmEmailAsync(email, code);
            }
        }
예제 #2
0
        /// <summary>
        /// 生成邮件验证码
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="type">验证码类型</param>
        /// <returns></returns>
        public async Task<string> GenerateEmailConfirmationTokenIfNotExistAsync(long userId, EmailConfirmationType type)
        {
            using(KoalaBlogDbContext dbContext = new KoalaBlogDbContext())
            {
                EmailConfirmationHandler emailConfirmationHandler = new EmailConfirmationHandler(dbContext);

                return await emailConfirmationHandler.GenerateEmailConfirmationTokenIfNotExistAsync(userId, type);
            }
        }