This repository has been archived by the owner on Jan 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpassword_changer_sonis.module
executable file
·81 lines (65 loc) · 2.82 KB
/
password_changer_sonis.module
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
81
<?php
/**
* @file
* Let user change their password in Sonis.
*
* Let user change their password in Sonis password and check if user
* set exist in SONIS.
*/
/**
* Implement hook_password_changer_api_check_user
*/
function password_changer_sonis_password_changer_api_check_user($user_name) {
//Make sonis call to userExist in SONIS
$results = sonisweb_integration_api("SonisWeb.CustomPages.password_changer", "userExist", "yes",
array(array('user_name', $user_name)));
//If results is True return TRUE
if ($results == 'True') {
watchdog('[password_changer_sonis_module][_api_check_user]', 'Check User: '.$user_name.' Results: '.$results, WATCHDOG_NOTICE);
return TRUE;
} //If results is False return FALSE
elseif ($results == 'False') {
watchdog('[password_changer_sonis_module][_api_check_user]', 'Check User: '.$user_name.' Results: '.$results, WATCHDOG_NOTICE);
return FALSE;
}//If not False and not True there is an error in coldfuncion funciton and return TRUE
else {
watchdog('[password_changer_sonis_module][_api_check_user]', 'SONIS is throwing an error.'.$results, WATCHDOG_ERROR);
return FALSE;
}
}
/*
*Implement hook password_changer_api_change_password
*From the password changer API
*/
function password_changer_sonis_password_changer_api_change_password($credentials) {
//Make sonis call to userExist in SONIS
$results = sonisweb_integration_api("SonisWeb200.CustomPages.password_changer", "changePassword", "yes",
array(array('user_name', $credentials['user_name']),
array('new_password', $credentials['password'])));
//If results is True return TRUE
if ($results == 'True') {
return password_changer_api_status(array('status' => 'status',
'message' => 'Password has been change in SONIS.'));
} //If results is False return FALSE
elseif ($results == 'False') {
return password_changer_api_status(array('status' => 'error',
'message' => 'Password has not been change in SONIS.'));
}//If not False and not True there is an error in coldfuncion funciton and return TRUE
else {
watchdog('[password_changer_sonis_module][_change_password]', 'SONIS is throwing an error.', WATCHDOG_ERROR);
return password_changer_api_status(array('status' => 'error',
'message' => 'Password has not been change in SONIS, their is an error in the SONIS call.'));
}
}
/**
* Implement hook_help()
*/
/*
function password_changer_sonis_help($path, $arg) {
switch ($path) {
case 'admin/help#password_changer_angel':
$output = '<p>' . t('Just testing help hook') . '</p>';
return $output;
}
}
*/