Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Maxime Besson
lemonldap-ng
Commits
f1b912a8
Commit
f1b912a8
authored
Sep 04, 2018
by
Yadd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add delCookie method
parent
9ed4303d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm
+38
-0
No files found.
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm
View file @
f1b912a8
...
...
@@ -139,6 +139,31 @@ sub addCookie {
push
@
{
$self
->
respHeaders
},
'
Set-Cookie
'
=>
$cookie
;
}
sub
delCookie
{
my
(
$self
,
$cookieName
)
=
@_
;
my
$i
=
0
;
@
{
$self
->
respHeaders
}
=
map
{
# Look for a Set-Cookie header
if
(
$_
=~
/^Set-Cookie$/i
)
{
$i
=
1
;
return
();
}
elsif
(
$i
)
{
# Keep other cookies
unless
(
/^$cookieName\s*=/i
)
{
$i
=
0
;
return
(
'
Set-Cookie
'
=>
$_
);
}
#Value is hidden here
return
();
}
return
$_
;
}
@
{
$self
->
respHeaders
};
}
# TODO: oldpassword
1
;
__END__
...
...
@@ -225,6 +250,19 @@ see notification plugin.
Returns positive/warning/negative depending on value stored in error property.
=head2 Cookie methods
=over
=item addCookie(string $cookie): add cookie in $req response headers. String
is a complete cookie string, ex: "lemonldap=xxx"
=item delCookie(string $cookieName): remove cookie from $req response headers.
It doesn't remove navigator cookie but remove a "Set-Cookie" header if value
match "L<lt>cookieNameL<gt>=..."
=back
=head1 SEE ALSO
L<http://lemonldap-ng.org/>, L<Lemonldap::NG::Common::PSGI::Request>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment