示例#1
0
        public BusinessLayerResult <Tester> LoginTester(TesterLoginViewModel data)
        {
            Tester t = Find(x => x.mail == data.email && x.password != data.password);

            if (t != null)
            {
                t.notifications.Add(new Notification {
                    notification = "IP: " + GetIp() + " - HATALI GİRİŞ YAPILMIŞTIR", link = "#"
                });
            }
            Tester tester = Find(x => x.mail == data.email && x.password == data.password);
            BusinessLayerResult <Tester> res = new BusinessLayerResult <Tester>();

            res.Result = tester;
            if (tester != null)
            {
                if (!tester.IsActive)
                {
                    res.AddError(ErrorMessageCode.UserIsNotActive, "Hesap aktifleştirilmemiştir.");
                    res.AddError(ErrorMessageCode.CheckYourEmail, "Lütfen E-Posta adresinizi kontrol ediniz.");
                }
            }
            else
            {
                res.AddError(ErrorMessageCode.EMailorPassWrong, "Kullanıcı adı ya da parola uyuşmuyor.");
            }
            return(res);
        }
示例#2
0
        public ActionResult TesterLogin(TesterLoginViewModel model)
        {
            if (ModelState.IsValid)
            {
                TesterManager tm = new TesterManager();
                BusinessLayerResult <Tester> res = tm.LoginTester(model);
                if (res.Errors.Count > 0)
                {
                    if (res.Errors.Find(x => x.Code == ErrorMessageCode.UserIsNotActive) != null)
                    {
                        ViewBag.SetLink = "http://localhost:53605/Home/TesterActivate/" + res.Result.ActivateGuid.ToString();
                    }

                    res.Errors.ForEach(x => ModelState.AddModelError("", x.Message));
                    return(View(model));
                }
                Session["login"] = res.Result;     //Session'a kullanıcı bilgi saklama..
                return(RedirectToAction("Index")); //Yönlendirme
            }

            return(View());
        }