This repository has been archived by the owner on Aug 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsecurepass.admin.inc
63 lines (53 loc) · 1.91 KB
/
securepass.admin.inc
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
<?php
use Securepass\Securepass;
/**
* @file
* Administration page callbacks for the fbconnect module.
*/
function securepass_api_keys_settings($form, &$form_state) {
$status = securepass_api_check_status();
if ($status !== true) {
$status_message = '<strong><small style="color: red;">' . $status . '</small></strong>';
}
else {
$status_message = '<strong><small style="color: green;">' . t('Connected') . '</small></strong>';
}
$form['securepass_status'] = array(
'#type' => 'item',
'#title' => t('Securepass server status'),
'#markup' => $status_message
);
$form['securepass_app_id'] = array(
'#type' => 'textfield',
'#required' => TRUE,
'#title' => t('Application ID'),
'#default_value' => variable_get('securepass_app_id', NULL),
'#description' => t('Securepass application id.'),
);
$form['securepass_app_secret'] = array(
'#type' => 'textfield',
'#required' => TRUE,
'#title' => t('Application Secret'),
'#default_value' => variable_get('securepass_app_secret', NULL),
'#description' => t('Securepass application secret.'),
);
return system_settings_form($form);
}
/**
* Authentication settings
*/
function securepass_authentication_settings($form, &$form_state) {
$active = securepass_api_check_status() ?: false;
if ($active !== true) {
$disabled = true;
drupal_set_message(t('Securepass is not responding or you are not authorized, authentication temporary disabled.'), 'error');
}
$form['securepass_authentication'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Securepass authentication'),
'#description' => t('Activating this option will override standard Drupal authentication using Securepass API to autenticate the users.'),
'#default_value' => variable_get('securepass_authentication', FALSE),
'#disabled' => (isset($disabled) ? $disabled : false)
);
return system_settings_form($form);
}