You are here

function lockr_login_form_submit in Lockr 7.3

Same name and namespace in other branches
  1. 7 lockr.login.inc \lockr_login_form_submit()
  2. 7.2 lockr.login.inc \lockr_login_form_submit()

Use login credentials to register the site.

File

./lockr.login.inc, line 70
Form callbacks for the Lockr login form.

Code

function lockr_login_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  $name = variable_get('site_name');
  try {
    lockr_site_client()
      ->register($values['email'], $values['pass'], $name);
  } catch (LockrClientException $e) {
    form_set_error('', t('Login credentials incorrect, please try again.'));
    return;
  } catch (LockrServerException $e) {
    form_set_error('', t('An unknown error has occurred, please try again later.'));
    return;
  }
  drupal_set_message(t("That's it! This site is added to Lockr; your keys are now safely stored off-site."));
  $form_state['redirect'] = $form_state['storage']['next'];
}