Просмотр исходного кода

Add warning if user tries to login with yesscrypt hashed password

Not yet able to authenticate yet
Jaap Marcus 4 лет назад
Родитель
Сommit
d7a3357b23
2 измененных файлов с 6 добавлено и 1 удалено
  1. 4 1
      bin/v-check-user-password
  2. 2 0
      web/login/index.php

+ 4 - 1
bin/v-check-user-password

@@ -62,7 +62,10 @@ if echo "$shadow" | grep -qE '^\$[0-9a-z]+\$[^\$]+\$'
 then
     salt=$(echo "$shadow" |cut -f 3 -d \$)
     method=$(echo "$shadow" |cut -f 2 -d \$)
-    if [ "$method" -eq '1' ]; then
+    if [ "$method" = "y" ]; then
+        echo "Unsuported hash method";
+        exit 1;   
+    elif [ "$method" -eq '1' ]; then
         method='md5'
     elif [ "$method" -eq '6' ]; then
         method='sha-512'

+ 2 - 0
web/login/index.php

@@ -107,6 +107,8 @@ function authenticate_user($user, $password, $twofa = '')
             sleep(2);
             if($return_var == 5){
                 $error = '<a class="error">' . _('Account has been suspended') . '</a>';   
+            }elseif($return_var == 1){
+                $error = '<a class="error">' . _('Unsuported hash method') . '</a>';     
             }else{
                 $error = '<a class="error">' . _('Invalid username or password') . '</a>';    
             }