Exemplo n.º 1
0
 /// <summary>
 /// 是否通过验证
 /// </summary>
 /// <returns></returns>
 public static bool IsAuthPass()
 {
     try
     {
         object objModel = Common.DataCache.GetCache("authpass");
         if (objModel == null)
         {
             bool   ispass = false;
             string email  = config["authemail"].ObjToStr();
             string domain = System.Web.HttpContext.Current.Request.Url.Host;
             if (domain.Contains("localhost") || domain.Contains("127.0.0.1"))
             {
                 return(true);
             }
             using (com.dukeycms.www.dukeyauthcms auth = new com.dukeycms.www.dukeyauthcms())
             {
                 if (auth.AuthUser(email, domain) == "ok")
                 {
                     ispass = true;
                 }
             }
             Common.DataCache.SetCache("authpass", ispass);
             return(ispass);
         }
         else
         {
             return((bool)objModel);
         }
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 是否通过验证
 /// </summary>
 /// <returns></returns>
 public static bool IsAuthPass()
 {
     try
     {
         object objModel = Common.DataCache.GetCache("authpass");
         if (objModel == null)
         {
             bool ispass = false;
             string email = config["authemail"].ObjToStr();
             string domain = System.Web.HttpContext.Current.Request.Url.Host;
             if (domain.Contains("localhost") || domain.Contains("127.0.0.1"))
             {
                 return true;
             }
             using (com.dukeycms.www.dukeyauthcms auth = new com.dukeycms.www.dukeyauthcms())
             {
                 if (auth.AuthUser(email, domain) == "ok")
                 {
                     ispass = true;
                 }
             }
             Common.DataCache.SetCache("authpass", ispass);
             return ispass;
         }
         else
         {
             return (bool)objModel;
         }
     }
     catch
     {
         return false;
     }
 }