Browse Source

Merge pull request #73 from BlackCodec/master

Encryption support for user.ini by @BlackCodec.
pull/89/head
Danang Probo Sayekti 11 years ago
parent
commit
dbf065b684
2 changed files with 8 additions and 2 deletions
  1. +5
    -1
      config/users/username.ini.example
  2. +3
    -1
      system/admin/admin.php

+ 5
- 1
config/users/username.ini.example View File

@ -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

+ 3
- 1
system/admin/admin.php View File

@ -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…
Cancel
Save