You are here

function lingotek_setup_account_settings_form_submit in Lingotek Translation 7.2

Same name and namespace in other branches
  1. 7.7 lingotek.setup.inc \lingotek_setup_account_settings_form_submit()
  2. 7.3 lingotek.setup.inc \lingotek_setup_account_settings_form_submit()
  3. 7.4 lingotek.setup.inc \lingotek_setup_account_settings_form_submit()
  4. 7.5 lingotek.setup.inc \lingotek_setup_account_settings_form_submit()
  5. 7.6 lingotek.setup.inc \lingotek_setup_account_settings_form_submit()

Account Settings (for Current Users) - Form Processing

File

./lingotek.setup.inc, line 285
Lingotek Easy Install Process.

Code

function lingotek_setup_account_settings_form_submit($form, $form_state) {
  $login_id = $form_state['values']['lingotek_lid'];
  $password = $form_state['values']['lingotek_pid'];

  //debug( $login_id );

  //debug( $password );

  // Validate the Account - Can we Login?
  // These are V4 Basic Auth API Calls for Legacy Users
  $lingotek_url = variable_get('lingotek_url', LINGOTEK_API_SERVER);
  $communities = lingotek_get_communities_v4($login_id, $password, $lingotek_url . '/lingopoint/api/4');
  if ($communities === FALSE) {
    drupal_set_message(t('Invalid login or password.'), 'error');
  }
  else {

    // Login Successful:  Valid Account
    $_SESSION['lingotek_setup_path'] = array(
      'admin/config/lingotek/account-settings',
    );
    drupal_set_message(t('Your account settings have been saved.'));
    variable_set('lingotek_login_id', $login_id);
    variable_set('lingotek_password', $password);
    drupal_goto('admin/config/lingotek/community-select');
  }

  // END:  Valid Login
}