예제 #1
0
 public RecaptchaContext(RecaptchaState challengeSucceeded, string hostname, DateTime timestamp)
 {
     State     = challengeSucceeded;
     Hostname  = hostname;
     Timestamp = timestamp;
 }
예제 #2
0
 private void SetCaptcha(RecaptchaState state, ReCaptchaType type)
 {
     if (string.IsNullOrEmpty(state.Challenge))
     {
         WaveUrl = null;
         ImageUrl = null;
     }
     else
     {
         if (type == ReCaptchaType.Image)
         {
             ImageUrl = state.Server + "image?c=" + state.Challenge;
             WaveUrl = null;
         }
         else
         {
             ImageUrl = null;
             WaveUrl = (state.Server + "image?c=" + state.Challenge).Replace("https://", "http://");
         }
     }
 }
 public RecaptchaContext(RecaptchaState challengeSucceeded)
 {
     State = challengeSucceeded;
 }
예제 #4
0
 public void OnChallengeReceived(string challenge
     , int timeout
     , string server
     , string site
     , string error_message
     , string programming_error
     , bool is_incorrect)
 {
     RecaptchaState state = new RecaptchaState();
     state.Challenge = challenge;
     state.Timeout = timeout;
     state.Server = server;
     state.Site = site;
     state.ErrorMessage = error_message;
     state.ProgrammingError = programming_error;
     state.IsIncorrect = is_incorrect;
     lastState = state;
     timerReload.Interval = TimeSpan.FromMilliseconds((state.Timeout - 60 * 5) * 1000);
     timerReload.Start();
     if (CaptchaType == ReCaptchaType.Audio)
     {
         timerReload.Stop();
         Reload(ReCaptchaReloadReason.ChangeTypeAudio);
     }
     else
     {
         SetCaptcha(state, CaptchaType);
     }
 }