-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkmail.common.inc
52 lines (49 loc) · 1.21 KB
/
checkmail.common.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
<?php
/**
* @file
* This file contains common functionality used in multiple files.
*/
/**
* Encrypts a user's password.
*
* This function gives the option of not encrypting, by simply returning the
* password, if the Encrypt (http://drupal.org/project/encrypt) module is not
* installed.
*
* @param string $password
* The password to encrypt.
*
* @return string
* The encrypted password.
*/
function _checkmail_encrypt_password($password) {
$config = config('checkmail.settings');
if ($config->get('checkmail_use_encryption') === 1) {
if (module_exists('encrypt')) {
$password = encrypt($password);
}
}
return $password;
}
/**
* Decrypts a user's password.
*
* This function gives the option of not decrypting, by simply returning the
* password, if the Encrypt (http://drupal.org/project/encrypt) module is not
* installed.
*
* @param string $password
* The password to decrypt.
*
* @return string
* The decrypted password.
*/
function _checkmail_decrypt_password($password) {
$config = config('checkmail.settings');
if ($config->get('checkmail_use_encryption') === 1) {
if (module_exists('encrypt')) {
$password = decrypt($password);
}
}
return $password;
}