Esempio n. 1
0
 public void Mod()
 {
     if (CheckAjax())
     {
         if (CheckRight())
         {
             if (IsPost)
             {
                 M.SmsTemplate tmpl = new M.SmsTemplate()
                 {
                     Name    = Request["Name"],
                     Content = Request["Content"],
                 };
                 SetResult(tmpl.Update(DataSource, ColumnMode.Include, "Content"), () =>
                 {
                     WritePostLog("MOD");
                 });
             }
             else
             {
                 NotFound();
             }
         }
     }
 }
Esempio n. 2
0
        public void SendSms(string name)
        {
            try
            {
                PassportSection section = PassportSection.GetSection();
                if (!section.VerifyMobile)
                {
                    throw new Exception();
                }

                long         mobile   = long.Parse(Request.Form["Mobile"]);
                int          timespan = SMSCaptchaSection.GetSection().TimeSpan;
                V.MobileHash hash     = V.MobileHash.Create(DataSource, mobile, V.MobileHash.Password, timespan);
                if (hash == null)
                {
                    throw new Exception();
                }

                string       md5 = string.Concat(ClientIp, "\r\n", Request.UserAgent).MD5();
                V.StringHash sh  = V.StringHash.Create(DataSource, md5, V.StringHash.SmsHash, timespan);
                if (sh == null)
                {
                    throw new Exception();
                }

                S.SmsTemplate temp = S.SmsTemplate.GetByName(DataSource, S.SmsTemplate.Register);
                if (temp.Type == S.SmsTemplateType.Template)
                {
                    SendTemplateImpl(name, mobile, temp.Content, hash.Hash);
                }
                else
                {
                    SendImpl(name, mobile, temp.Content, hash.Hash);
                }
                SetResult(true);
            }
            catch (Exception)
            {
                SetResult(false);
            }
        }