1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* theming functions for ldap_authentication module
|
6
|
*
|
7
|
*/
|
8
|
|
9
|
/**
|
10
|
* Returns HTML for user login block links.
|
11
|
* @param $variables
|
12
|
* An associative array containing:
|
13
|
* - hide_reset_pwd (boolean) whether reset password link should be visible
|
14
|
* - auth_conf: object with ldap authentication configuration data
|
15
|
*
|
16
|
* @ingroup themeable
|
17
|
*/
|
18
|
function theme_ldap_authentication_user_login_block_links($variables) {
|
19
|
extract($variables);
|
20
|
|
21
|
// the code below modified from user.module user_login_block function
|
22
|
$items = array();
|
23
|
if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
|
24
|
$items[] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
|
25
|
}
|
26
|
if ($show_reset_pwd) {
|
27
|
$items[] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
|
28
|
}
|
29
|
elseif ($auth_conf->ldapUserHelpLinkUrl) {
|
30
|
$items[] = l(t($auth_conf->ldapUserHelpLinkText), $auth_conf->ldapUserHelpLinkUrl);
|
31
|
}
|
32
|
|
33
|
$output = theme('item_list', array('items' => $items));
|
34
|
return $output;
|
35
|
}
|
36
|
|
37
|
/**
|
38
|
* Returns HTML warning text for request new password/password reset form.
|
39
|
* @param $variables
|
40
|
* An associative array containing:
|
41
|
* - auth_conf: object with ldap authentication configuration data
|
42
|
*
|
43
|
* @ingroup themeable
|
44
|
*/
|
45
|
function theme_ldap_authentication_user_pass_message($variables) {
|
46
|
extract($variables);
|
47
|
if ($auth_conf->authenticationMode == LDAP_AUTHENTICATION_EXCLUSIVE && $auth_conf->passwordOption != LDAP_AUTHENTICATION_PASSWORD_FIELD_ALLOW) {
|
48
|
$msg = t('This page is only useful for the site administrator. All other users
|
49
|
need to reset their passwords');
|
50
|
if ($auth_conf->ldapUserHelpLinkUrl) {
|
51
|
$msg .= ' ' . t('at') . ' ' . l(t($auth_conf->ldapUserHelpLinkText), $auth_conf->ldapUserHelpLinkUrl) . '.';
|
52
|
}
|
53
|
else {
|
54
|
$msg .= ' ' . t('with one of your organizations password management sites.');
|
55
|
}
|
56
|
}
|
57
|
else { // mixed mode
|
58
|
$msg = ""; // warning will come up on validation. we do not know if the user is ldap authenticated or not until they submit form.
|
59
|
}
|
60
|
|
61
|
return $msg;
|
62
|
}
|
63
|
|
64
|
/**
|
65
|
* Returns HTML warning text when an ldap authenticated user tries to reset their password.
|
66
|
* @param $variables
|
67
|
* An associative array containing:
|
68
|
* - auth_conf: object with ldap authentication configuration data
|
69
|
* - account: user object
|
70
|
*
|
71
|
* @ingroup themeable
|
72
|
*/
|
73
|
function theme_ldap_authentication_user_pass_validate_ldap_authenticated($variables) {
|
74
|
extract($variables);
|
75
|
// already know user exists and is ldap authenticated
|
76
|
|
77
|
if ($auth_conf->ldapUserHelpLinkUrl) {
|
78
|
$msg = t('You may not reset your password here. You must reset your password via the directions at')
|
79
|
. ' ' . l(t($auth_conf->ldapUserHelpLinkText), $auth_conf->ldapUserHelpLinkUrl);
|
80
|
}
|
81
|
else {
|
82
|
$msg = t('You may not reset your password here. You must reset your password via one of your
|
83
|
organization\'s password management sites.');
|
84
|
}
|
85
|
return $msg;
|
86
|
}
|
87
|
|
88
|
|
89
|
/**
|
90
|
* The following three functions are theme callbacks for various messages
|
91
|
* from NTLM/seamless login integration.
|
92
|
*
|
93
|
* Provides a theme callback for successful login messages. The reason for
|
94
|
* using theme callbacks instead of a simple t() function is to provide the
|
95
|
* ability to have more complex message handling performed; an example would
|
96
|
* be to use the Real Name module to say "Welcome, User Name" upon successful
|
97
|
* login.
|
98
|
* @param $message
|
99
|
* A text string containing a translatable success message
|
100
|
*
|
101
|
* @ingroup themeable
|
102
|
*/
|
103
|
function theme_ldap_authentication_login_message($variables) {
|
104
|
extract($variables);
|
105
|
return $message;
|
106
|
}
|
107
|
|
108
|
/**
|
109
|
* Provides a theme callback for user not found messages.
|
110
|
* @param $message
|
111
|
* A text string containing a translatable "user not found" message
|
112
|
*
|
113
|
* @ingroup themeable
|
114
|
*/
|
115
|
function theme_ldap_authentication_message_not_found($variables) {
|
116
|
extract($variables);
|
117
|
return $message;
|
118
|
}
|
119
|
|
120
|
/**
|
121
|
* Provides a theme callback for authentication failure messages.
|
122
|
* @param $message
|
123
|
* A text string containing a translatable "authentication failure" message
|
124
|
*
|
125
|
* @ingroup themeable
|
126
|
*/
|
127
|
function theme_ldap_authentication_message_not_authenticated($variables) {
|
128
|
extract($variables);
|
129
|
return $message;
|
130
|
}
|