You are here

function lockr_login_form in Lockr 7.3

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

Register a Lockr user with already established credentials.

File

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

Code

function lockr_login_form($form, &$form_state) {
  try {
    $status = lockr_check_registration();
  } catch (LockrServerException $e) {
    drupal_goto('admin/config/system/lockr');
  }
  if ($status['exists']) {
    drupal_goto('admin/config/system/lockr');
  }
  $default_email = isset($_GET['email']) ? $_GET['email'] : NULL;
  $form['email'] = array(
    '#type' => 'textfield',
    '#title' => t('Email'),
    '#required' => TRUE,
    '#default_value' => $default_email,
    '#description' => t('Enter your @s email.', array(
      '@s' => 'Lockr',
    )),
  );
  $form['pass'] = array(
    '#type' => 'password',
    '#title' => t('Password'),
    '#required' => TRUE,
    '#description' => t('Enter the password that accompanies your email.'),
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Log in'),
  );
  $form_state['storage']['next'] = isset($_GET['next']) ? $_GET['next'] : '/admin/config/system/keys/add';
  return $form;
}