plugins/SpecialUserPrefs.php
changeset 591 2529833a7731
parent 586 234ddd896555
child 621 68f8a9cc0a18
equal deleted inserted replaced
590:03a60844c7c5 591:2529833a7731
   209           $q = $db->sql_query('SELECT password FROM '.table_prefix.'users WHERE user_id='.$session->user_id.';');
   209           $q = $db->sql_query('SELECT password FROM '.table_prefix.'users WHERE user_id='.$session->user_id.';');
   210           if ( !$q )
   210           if ( !$q )
   211             $db->_die();
   211             $db->_die();
   212           $row = $db->fetchrow();
   212           $row = $db->fetchrow();
   213           $db->free_result();
   213           $db->free_result();
   214           $old_pass = $aes->decrypt($row['password'], $session->private_key, ENC_HEX);
   214           $old_pass = $session->pk_decrypt($row['password'], ENC_HEX);
   215           
   215           
   216           $new_email = $_POST['newemail'];
   216           $new_email = $_POST['newemail'];
   217           
   217           
   218           $result = $session->update_user($session->user_id, false, $old_pass, false, $new_email);
   218           $result = $session->update_user($session->user_id, false, $old_pass, false, $new_email);
   219           if ( $result != 'success' )
   219           if ( $result != 'success' )
   255                 $errors .= '<div class="error-box" style="margin: 0 0 10px 0;">' . $lang->get('usercp_emailpassword_err_password_too_weak', array('score' => $score_inp)) . '</div>';
   255                 $errors .= '<div class="error-box" style="margin: 0 0 10px 0;">' . $lang->get('usercp_emailpassword_err_password_too_weak', array('score' => $score_inp)) . '</div>';
   256             }
   256             }
   257             // Encrypt new password
   257             // Encrypt new password
   258             if ( empty($errors) )
   258             if ( empty($errors) )
   259             {
   259             {
   260               $newpass_enc = $aes->encrypt($newpass, $session->private_key, ENC_HEX);
   260               $newpass_enc = $session->pk_encrypt($newpass, ENC_HEX);
   261               // Perform the swap
   261               // Perform the swap
   262               $q = $db->sql_query('UPDATE '.table_prefix.'users SET password=\'' . $newpass_enc . '\' WHERE user_id=' . $session->user_id . ';');
   262               $q = $db->sql_query('UPDATE '.table_prefix.'users SET password=\'' . $newpass_enc . '\' WHERE user_id=' . $session->user_id . ';');
   263               if ( !$q )
   263               if ( !$q )
   264                 $db->_die();
   264                 $db->_die();
   265               // Log out and back in
   265               // Log out and back in