Exemplo n.º 1
0
        public Person GetPerson(string userName, string password)
        {
            var result = _personRepository.GetAll().Where(p => p.UserName == userName).SingleOrDefault();

            if (result == null)
            {
                return(null);
            }
            if (EnDeCode.Decrypt(result.Password, StaticParams.SifrelemeParametresi) == password)
            {
                return(result);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
 public static ForbiddenAccessTypes IsLogin()
 {
     try
     {
         var Cookies = HttpContext.Current.Request.Cookies;
         if (CookieKeys.Any(p => Cookies[p] == null || string.IsNullOrEmpty(Cookies[p].Value) || string.IsNullOrEmpty(UtilityManager.Base64Decode(Cookies[p].Value))))
             return ForbiddenAccessTypes.IsLogout;
         var forbiddenType = ForbiddenAccessTypes.PersonId;
         try
         {
             var personId = JsonConvert.DeserializeObject<string>(EnDeCode.Decrypt(FormsAuthentication.Decrypt(HttpContext.Current.Request.Cookies[".u"].Value).Name, StaticParams.SifrelemeParametresi));
             forbiddenType = ForbiddenAccessTypes.UnForbidden;
             return forbiddenType;
         }
         catch (Exception ex) { return forbiddenType; }
     }
     catch (Exception ex) { return ForbiddenAccessTypes.IsLogout; }
 }
Exemplo n.º 3
0
        public static void SendMail(string title, string body, List <string> tos)
        {
            MailMessage mail       = new MailMessage();
            SmtpClient  SmtpServer = new SmtpClient(Resources.Parameter.SistemMailSmtpClient);

            mail.From = new MailAddress(Resources.Parameter.SistemMail, Resources.Parameter.SistemMailBaslik);
            foreach (var item in tos)
            {
                mail.To.Add(item);
            }
            mail.Subject           = title;
            mail.Body              = body;
            mail.IsBodyHtml        = true;
            SmtpServer.Port        = 587;
            SmtpServer.Credentials = new System.Net.NetworkCredential(Resources.Parameter.SistemMail, EnDeCode.Decrypt(Resources.Parameter.SistemMailSifre, StaticParams.SifrelemeParametresi));
            SmtpServer.Send(mail);
        }