Revert "Bug 34755: Backport Koha::Token change from bug 34478"

This reverts commit 46c0419a11.
This commit is contained in:
Fridolin Somers 2024-03-12 14:14:27 +01:00
parent 46c0419a11
commit fdd7731a46

View file

@ -57,8 +57,6 @@ use Digest::MD5 qw( md5_base64 );
use Encode;
use C4::Context;
use Koha::Exceptions::Token;
use Koha::Session;
use base qw(Class::Accessor);
use constant HMAC_SHA1_LENGTH => 20;
use constant CSRF_EXPIRY_HOURS => 8; # 8 hours instead of 7 days..
@ -217,17 +215,11 @@ sub decode_jwt {
sub _add_default_csrf_params {
my ( $params ) = @_;
$params->{session_id} //= DEFA_SESSION_ID;
my $id;
my $session = Koha::Session->get_session( { sessionID => $params->{session_id} } );
if ($session) {
$id = $session->param('id');
my $userenv = C4::Context->userenv;
if ( ( !$userenv ) || !$userenv->{id} ) {
$userenv = { id => DEFA_SESSION_USERID };
}
if ( !$id ) {
$id = DEFA_SESSION_USERID;
}
$params->{id} //= Encode::encode( 'UTF-8', $id );
$params->{id} //= Encode::encode( 'UTF-8', $userenv->{id} );
$params->{id} .= '_' . $params->{session_id};
my $pw = C4::Context->config('pass');