示例#1
0
        private async Task <EmailCheck> VerifyMail(IEnumerable <string> emails, Dictionary <string, string> data)
        {
            var result = new EmailCheck {
                Data = data
            };

            foreach (var email in emails)
            {
                if (MailValidations.IsMailValid(email))
                {
                    var checkUser = await _userManager.FindByEmailAsync(email);

                    if (checkUser != null)
                    {
                        result.Data.Add(email, "Email already exists");
                    }
                    else
                    {
                        result.Emails.Add(email);
                    }
                }
                else
                {
                    result.Data.Add(email, "InvalidMail");
                }
            }
            return(result);
        }
示例#2
0
        public ActionResult New(ToDoFormViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                viewModel.ToDoPriorities = _context.ToDoPriorities.ToList();
                return(View("ToDoForm", viewModel));
            }

            var toDo = new ToDoList
            {
                Name             = viewModel.Name,
                CreatedAt        = viewModel.CreatedAt,
                Description      = viewModel.Description,
                Time             = viewModel.Time,
                ToDoPrioritiesId = viewModel.ToDoPriority,
                ToDoStatus       = viewModel.ToDoStatus,
                UserId           = UserId
            };
            var email = new EmailCheck
            {
                ApplicationUserId = UserId,
                ToDoListId        = toDo.Id,
                Hour       = false,
                HalfAnHour = false
            };

            _context.EmailChecks.Add(email);
            _context.ToDoLists.Add(toDo);
            _context.SaveChanges();

            return(RedirectToAction("Index", "Home"));
        }
示例#3
0
        private async void button1_Click(object sender, EventArgs e)
        {
            textBox3.Clear();
            var progressLog = new Progress <string>(update => textBox3.AppendText(update + Environment.NewLine));
            var engine      = new EmailCheck(chromiumSettings: CompositionRoot.Resolve <IChromiumSettings>(), progressLog: progressLog);
            var result      = await engine.RunScenario(emails : textBox1.Lines);

            textBox2.Lines = result.ToArray();
        }
示例#4
0
        public async Task <CheckEmailValid> EmailValidation(EmailCheck input)
        {
            var output = new CheckEmailValid();

            var data = "success";

            using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant))
            {
                var user = _userManager.Users.Where(u => u.EmailAddress == input.Email).FirstOrDefault();
                if (user != null)
                {
                    data = "failure";
                }
            }
            output.email = data;
            return(output);
        }
        public static string LoginUserPrompter(Abstractions.IRepositoryCustomer <Customer1> repo)
        {
            var customers = repo.ReadInCustomer();

            string email = EmailCheck.NewEmailChecker();

            if (email.Equals("quit"))
            {
                return("@");
            }

            string password = PassCheck.NewPassChecker();

            if (password.Equals("quit"))
            {
                return("@");
            }
            string name        = "";
            bool   correctAuth = false;

            foreach (var Cx in customers)
            {
                if (Cx.Email != null && Cx.Email.Equals(email))
                {
                    if (Cx.UserPass.Equals(password))
                    {
                        name        = Cx.Fname;
                        correctAuth = true;
                    }
                }
            }
            if (!correctAuth)
            {
                Console.Clear();
                Console.WriteLine("No User found with that email and password.");
                Thread.Sleep(1000);
                return("@");
            }

            return(name);
        }
示例#6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="newemail"></param>
        /// <returns></returns>
        public string SendChange_email(string newemail)
        {
            string message;

            try
            {
                string tempcontent = Helper.GetEmailChangeTemp();
                if (!string.IsNullOrEmpty(tempcontent))
                {
                    var itemInfo = new EmailCheckInfo
                    {
                        userid    = CurrentUser.ID,
                        status    = EmailCheckStatus.提交中,
                        addtime   = DateTime.Now,
                        checktime = DateTime.Now,
                        email     = newemail,
                        typeid    = EmailCheckType.修改,
                        Expired   = DateTime.Now.AddDays(7)
                    };

                    var bll    = new EmailCheck();
                    int result = bll.Add(itemInfo);
                    if (result > 0)
                    {
                        string parms       = string.Format("id={0}&", result);
                        string securityKey = HttpUtility.UrlEncode(Cryptography.RijndaelEncrypt(parms));
                        string verifyurl   = GetVerifyUrl(securityKey);

                        tempcontent = tempcontent.Replace("{#personName#}", CurrentUser.full_name);
                        tempcontent = tempcontent.Replace("{#useremail#}", newemail);
                        string sitename   = "";
                        string sitedomain = "";
                        if (webInfo != null)
                        {
                            sitename   = webInfo.Name;
                            sitedomain = webInfo.Domain;
                        }
                        tempcontent = tempcontent.Replace("{#sitename#}", sitename);
                        tempcontent = tempcontent.Replace("{#sitedomain#}", sitedomain);
                        tempcontent = tempcontent.Replace("{#verify_email#}", verifyurl);

                        var emailcom = new EmailHelper(CurrentUser.Email
                                                       , CurrentUser.Email + "修改邮箱"
                                                       , tempcontent
                                                       , true
                                                       , System.Text.Encoding.Default);

                        emailcom.Send2();

                        message = "操作成功";
                    }
                    else
                    {
                        message = "系统出错,请联系管理员";
                    }
                }
                else
                {
                    message = "系统出错,未找到邮件模版!";
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }

            return(message);
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string msg = "";

            try
            {
                string   decodeparams = Cryptography.RijndaelDecrypt(Parms);
                string[] arr          = decodeparams.Split('&');
                if (arr.Length == 2)
                {
                    int itemId = 0;

                    if (int.TryParse(arr[0].Split('=')[1], out itemId))
                    {
                        var            bll      = new EmailCheck();
                        EmailCheckInfo itemInfo = bll.GetModel(itemId);
                        if (
                            itemInfo == null ||
                            itemInfo.status != EmailCheckStatus.提交中 ||
                            itemInfo.Expired < DateTime.Now
                            )
                        {
                            msg = "无效的信息或此链接已使用";
                        }
                        else
                        {
                            itemInfo.checktime = DateTime.Now;
                            itemInfo.status    = EmailCheckStatus.已审核;

                            msg = "操作";
                            if (itemInfo.typeid == EmailCheckType.认证)
                            {
                                msg = "绑定邮箱";
                            }
                            else if (itemInfo.typeid == EmailCheckType.修改)
                            {
                                msg = "修改邮箱";
                            }
                            else if (itemInfo.typeid == EmailCheckType.注册)
                            {
                                msg = "激活邮箱";
                            }

                            if (bll.Update(itemInfo))
                            {
                                msg += "成功";
                            }
                            else
                            {
                                msg += "失败";
                            }
                        }
                    }
                    else
                    {
                        msg = "无效参数";
                    }
                }
            }
            catch
            {
                msg = "提交无效的参数";
            }
            string script = string.Format(@"
<SCRIPT LANGUAGE='javascript'><!--
alert({0});
location.href='/index.aspx';
//--></SCRIPT>
", AntiXss.JavaScriptEncode(msg));

            HttpContext.Current.Response.Write(script);
        }
        public IActionResult CheckEmail([FromBody] EmailCheck Input)
        {
            List <User> User = Context.Users.Where(u => u.Email == Input.Email).ToList();

            return(Ok(new { isTaken = User.Count > 0 }));
        }