blob: 414d53ba494b2fc922ecdc755970754be5781641 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<% $query %>\
<%init>
my %opt = @_;
if ( $opt{secure} ) {
foreach my $param (grep /pay(info\d?|cvv)$/, $cgi->param) {
my $value = $cgi->param($param);
next unless length($value);
my $encrypted = FS::Record->encrypt( $value );
$cgi->param($param, $encrypted);
}
}
my $query = $cgi->query_string;
if ( length($query) > 1920 || $opt{secure} ) { #stupid IE 2083 URL limit
my $session = random_id(9);
my $pref = new FS::access_user_pref({
'usernum' => $FS::CurrentUser::CurrentUser->usernum,
'prefname' => "redirect$session",
'prefvalue' => $query,
'expiration' => time + ( $opt{secure} ? 120 #2m?
: 3600 #1h?
),
});
local($FS::Record::no_history) = 1;
my $pref_error = $pref->insert;
if ( $pref_error ) {
die "FATAL: couldn't even set redirect cookie: $pref_error".
" attempting to set redirect$session to $query\n";
}
$query = "redirect=$session";
}
</%init>
|