function drush_lockr_register in Lockr 8.4
Same name and namespace in other branches
- 8.2 lockr.drush.inc \drush_lockr_register()
- 8.3 lockr.drush.inc \drush_lockr_register()
- 7.3 lockr.drush.inc \drush_lockr_register()
- 7.2 lockr.drush.inc \drush_lockr_register()
- 4.x lockr.drush.inc \drush_lockr_register()
Registers the site with lockr.
File
- ./
lockr.drush.inc, line 34 - Hooks and callbacks for drush.
Code
function drush_lockr_register($email) {
$name = variable_get('site_name');
$client = \Drupal::service('lockr.client');
$password = drush_get_option('password');
try {
$client
->register($email, $password, $name);
} catch (LockrClientException $e) {
if ($e->title === 'Missing header value' && $e->description === 'The Auth header is required.') {
$msg = 'Email is already registered, please provide a password.';
}
elseif ($e->title === 'Partner mismatch') {
$msg = "We didn't recognize your certificate, please ensure the provide path is a valid Lockr certificate.";
}
elseif ($e->title === 'Site exists') {
$msg = 'This site is already registered. If you are experiencing issues, please contact support@lockr.io.';
}
elseif ($e->title === 'Credentials invalid') {
$msg = 'The username and password did not match, please try again.';
}
else {
$msg = 'An unknown error occurred, please try again later.';
}
\Drupal::logger($msg, 'error');
} catch (LockrServerException $e) {
\Drupal::logger('An unknown error occurred, please try again.', 'error');
}
}