Home › Forum › Plugin e temi di WP › accesso ad utenti importati nel db con password SHA256 (tipo da snitz forum)
-
AutorePost
-
-
7 Settembre 2007 alle 9:08 #4506morenozagoPartecipante
Modifiche wordpress per permettere l’accesso ad utenti importati nel db con password di tipo SHA256 (tipo da snitz forum).
Tutto su /wp-includes/:
1.) inseriti file per la classe SHA256: hash_sha256.php, hash_base.php (funzioni che ci permettono di calcolare hash256, classe recuperabile in rete)
2.) modificato pluggable.php
modificata funzione wp_login (modifiche in grassetto):
function wp_login($username, $password, $already_md5 = false) {
require_once( ‘hash_sha256.php’ );
global $wpdb, $error;
…
…
if (!$login) {
$error = __(‘ERROR: Invalid username.’);
return false;
} else {
// If the password is already_md5, it has been double hashed.
// Otherwise, it is plain text.
if ( ($already_md5 && md5($login->user_pass)==$password ) || ($login->user_login == $username && ($login->user_pass == md5($password) || $login->user_pass == SHA256::hash($password)) ) ) {
/* IF (TRUE_WITH_SHA) UPDATE THE PWD ON THE DB – aggiorna la pwd nel db (da sha256 a md5) se si ha avuto accesso grazie a sha256 */
if($login->user_pass==SHA256::hash($password)){
$wpdb->query(“UPDATE $wpdb->users SET user_pass = MD5(‘$password’) WHERE user_login = ‘$login->user_login'”);
}
/*
*/return true;
} else {
…
…
-
25 Ottobre 2007 alle 10:24 #47548LordrasPartecipante
Ciao,
il tuo post mi interessa.
Devo traferire degli utenti da un altro sito, (che ho fatto io…) e volevo modificare wp in modo che salvi le password in sha256 proprio come dici tu.
Al punto 1 parli di hash_sha256.php, hash_base.php, dove li devo mettere?
Poi dimmi se ho capito bene.. le modifiche che fai al file pluggable.php all’if verifica se c’è un doppio hash di md5 o || se c’è un semplice hash md5 o || se invece c’è l’hash sha256..
..poi se è sha256 aggiorni il db.
Right??
Basta questo?
Grazie mille!
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.