You are here

function lockr_admin_register_submit in Lockr 7.2

Same name and namespace in other branches
  1. 7 include/register_form.inc \lockr_admin_register_submit()

Submit the register form.

1 string reference to 'lockr_admin_register_submit'
lockr_admin_register_form in include/register_form.inc
Returns the register form.

File

include/register_form.inc, line 53
Form handlers for registration.

Code

function lockr_admin_register_submit($form, &$form_state) {
  $values = $form_state['values'];
  $next = $form_state['storage']['redirect'];
  $name = variable_get('site_name');
  try {
    lockr_site_client()
      ->register($values['email'], NULL, $name);
  } catch (LockrClientException $e) {
    if ($e->title === 'Site exists') {
      drupal_set_message('This site is already registered.');
      $form_state['redirect'] = $next;
      return;
    }
    else {
      drupal_set_message(t('This email is already registered with Lockr. Please login to register a new site.'));
      drupal_goto('admin/config/system/lockr/login', array(
        'query' => array(
          'next' => $next,
          'email' => $form_state['values']['email'],
        ),
      ));
    }
  } catch (LockrServerException $e) {
    form_set_error('', t('An unknown error has occurred, please try again later.'));
  }
  drupal_set_message(t("That's it! You're signed up with Lockr; your keys can now be safely stored off-site."));
  $form_state['redirect'] = $next;
}