You are here

function oauth_request_call_validate in OAuth 1.0 6

File

./oauth.module, line 622

Code

function oauth_request_call_validate($form, &$form_state) {
  if ($form_state['values']['op'] == 'Request Token Call') {
    if (!$form_state['values']['consumer_key'] || !$form_state['values']['consumer_secret'] || !$form_state['values']['request_url'] || !$form_state['values']['sig_method']) {
      form_set_error('form', t('All Fields are Required to produce Request Tokens'));
    }
  }
  if ($form_state['values']['op'] == 'OAuth Authentication Call') {
    if (!$form_state['values']['oauth_token'] || !$form_state['values']['oauth_token_secret'] || !$form_state['values']['auth_url']) {
      form_set_error('form', t('All Fields are Required to make Authentication Requests to Server'));
    }
  }
  if ($form_state['values']['op'] == 'OAuth Access Token Call') {
    if (!$form_state['values']['access_url']) {
      form_set_error('form', t('Please fill Access endpoint URL (eg. http://yourdrupalsite.com/?q=oauth/access)'));
    }
  }
  if ($form_state['values']['op'] == 'Back To Request Token Page') {
    $_SESSION['oauth']['operation'] = '';
    $_SESSION['oauth']['key'] = '';
    $_SESSION['oauth']['key_secret'] = '';
    $_SESSION['oauth']['oauth_token'] = '';
    $_SESSION['oauth']['oauth_token_secret'] = '';
    $_SESSION['oauth']['oauth_access_token'] = '';
    $_SESSION['oauth']['oauth_access_token_secret'] = '';
    $_SESSION['oauth']['oauth_signature_method'] = '';
    return;
  }
}