You are here

function lockr_login_form_submit in Lockr 7

Same name and namespace in other branches
  1. 7.3 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 60
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 (ClientException $e) {
    form_set_error('', t('Login credentials incorrect, please try again.'));
    return;
  } catch (ServerException $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'];
}