forked from pantheon-systems/auth0-drupal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth0.install
80 lines (74 loc) · 1.93 KB
/
auth0.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
* @file
* Installation file for the auth0 module.
*/
/**
* Implements hook_schema().
*/
function auth0_schema() {
$schema['auth0_user'] = array(
'description' => 'Joins auth0 users with drupal users.',
'fields' => array(
'auth0_id' => array(
'description' => 'The user id on auth0',
'type' => 'varchar',
'length' => 100,
'not null' => TRUE,
),
'drupal_id' => array(
'description' => 'The user id on drupal',
'type' => 'int',
'not null' => TRUE,
),
'auth0_object' => array(
'description' => 'A serialized version of the auth0 user',
'type' => 'text',
'not null' => TRUE,
),
),
'indexes' => array(
'drupal_id' => array('drupal_id'),
),
'primary key' => array('auth0_id'),
);
return $schema;
}
/**
* Implements hook_install().
*/
function auth0_install() {
drupal_install_schema('auth0_user_services');
$css = "
#a0-widget .a0-panel {
min-width: 90%;
padding: 5%;
box-shadow: none;
-webkit-box-shadow: none;
}
#a0-widget .a0-panel {
background-color: #f6f6f2;
border-color: #f9f9f9;
}";
$config = \Drupal::service('config.factory')->getEditable('auth0.settings');
$config->set('auth0_login_css', $css)
->set('auth0_widget_cdn', 'https://cdn.auth0.com/js/lock/10.2/lock.min.js')
->set('auth0_form_title', 'Sign In')
->set('auth0_requires_verified_email', TRUE)
->set('auth0_allow_signup', TRUE)
->set('auth0_lock_extra_settings', '')
->save();
}
/**
* Implements hook_uninstall().
*/
function auth0_uninstall() {
variable_del('auth0_login_css');
variable_del('auth0_widget_cdn');
variable_del('auth0_form_title');
variable_del('auth0_requires_verified_email');
variable_del('auth0_allow_signup');
variable_del('auth0_domain');
variable_del('auth0_client_id');
variable_del('auth0_client_secret');
}