Lazy File Manager
| Current Path : /home/cruisin2/cruise.cruisingclub.org/modules/remote_auth/ |
| PPPath/home/cruisin2/cruise.cruisingclub.org/modules/remote_auth |
| Current File : /home/cruisin2/cruise.cruisingclub.org/modules/remote_auth/remote_auth.module |
<?php
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\EntityInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Url;
use Drupal\Core\File;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\node\Entity\Node;
use Drupal\paragraphs\Entity\Paragraph;
use Symfony\Component\HttpFoundation\Response;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\user\Entity\User;
use Drupal\Core\Routing\TrustedRedirectResponse;
use Drupal\Core\Datetime\DrupalDateTime;
//hook happens on login
function remote_auth_user_login($account){
remote_auth_send_auth($account);
}
function remote_auth_rehash($pw){
$seed = date("m-d-y-h");
$val =md5($seed . $pw, false);
return $val;
}
function remote_auth_send_auth($account){
$params = \Drupal::request()->query->all();
if(isset($params['remlog'])){// we have a remote auth request
$umail = ($account->getEmail());
$nonce = remote_auth_rehash(random_bytes(17));
\Drupal::configFactory()->getEditable('remote_auth.nonces')
->set($umail, $nonce)
->save();
$dest = $params['remlog'];
$resp = new TrustedRedirectResponse("$dest/admin/user/remlogin/$umail/$nonce",302);
$resp->send();
}
}
function remote_auth_get_sessid($mail){
$sql = "SELECT sess.`uid`, mail, `session` FROM `sessions` sess
JOIN `users_field_data` ufd ON ufd.uid = sess.uid
WHERE mail LIKE :mail";
$result = db_query($sql, array(':mail'=>$mail ));
if($row = $result->fetchAssoc() ) {
$sess = $row['session'];
return $sess;
}
return null;
}
?>Da3s File Manager Version 1.0, Coded By Da3s HaCkEr
Email: R0@hotmail.com
