mirror of
https://github.com/danpros/htmly.git
synced 2026-04-17 19:26:08 +05:30
Merge pull request #73 from BlackCodec/master
Encryption support for user.ini by @BlackCodec.
This commit is contained in:
commit
dbf065b684
2 changed files with 8 additions and 2 deletions
|
|
@ -1,5 +1,9 @@
|
|||
;Password
|
||||
password = yourpassword
|
||||
encryption = clear
|
||||
; encryption: not set, leave blank or set to clear or none to use plain text password for the user,
|
||||
; else set to encryption algoritm supported by hash function of php to use the selected
|
||||
; encryption
|
||||
|
||||
;Role
|
||||
role = admin
|
||||
role = admin
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ function user($key, $user=null) {
|
|||
// Create a session
|
||||
function session($user, $pass, $str = null) {
|
||||
$user_file = 'config/users/' . $user . '.ini';
|
||||
$user_enc = user('encryption', $user);
|
||||
$user_pass = user('password', $user);
|
||||
$password = (strlen($user_enc) > 0 && $user_enc !== 'clear' && $user_enc !== 'none')?hash($user_enc,$pass):$pass;
|
||||
|
||||
if(file_exists($user_file)) {
|
||||
if($pass === $user_pass) {
|
||||
|
|
@ -545,4 +547,4 @@ function clear_page_cache($url) {
|
|||
if (file_exists($p)) {
|
||||
unlink($p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue