Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
scripts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Benjamin Graillot
scripts
Commits
5a430b27
Commit
5a430b27
authored
Feb 08, 2017
by
Remi Oudin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrections de multiples bugs d'encodage dans le wiki.
parent
6ffb92b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
wiki/auth/anonymous_user.py
wiki/auth/anonymous_user.py
+1
-1
wiki/auth/cas.py
wiki/auth/cas.py
+8
-7
wiki/auth/categorie_public.py
wiki/auth/categorie_public.py
+3
-3
No files found.
wiki/auth/anonymous_user.py
View file @
5a430b27
...
...
@@ -52,7 +52,7 @@ class AnonymousAuth(BaseAuth):
p
=
urlparse
.
urlparse
(
request
.
url
)
# Prevent preference edition and quicklink when anonymous
if
action
==
"userprefs"
or
action
==
"quicklink"
:
url
=
urlparse
.
urlunparse
((
'https'
,
p
.
netloc
,
p
.
path
,
""
,
""
,
""
))
url
=
urlparse
.
urlunparse
((
'https'
,
p
.
netloc
,
p
.
path
,
""
,
""
,
""
))
.
encode
(
'utf8'
)
request
.
http_redirect
(
url
)
...
...
wiki/auth/cas.py
View file @
5a430b27
...
...
@@ -38,21 +38,22 @@ class PyCAS(object):
def
login_url
(
self
,
service
):
"""Return the login URL for the given service."""
url
=
self
.
server_url
+
self
.
login_path
+
'?service='
+
urllib
.
quote_plus
(
service
)
url
=
self
.
server_url
+
self
.
login_path
+
'?service='
+
urllib
.
quote_plus
(
service
.
encode
(
'utf8'
)
)
if
self
.
renew
:
url
+=
"&renew=true"
return
url
return
url
.
decode
(
'utf8'
)
def
logout_url
(
self
,
redirect_url
=
None
):
"""Return the logout URL."""
url
=
self
.
server_url
+
self
.
logout_path
if
redirect_url
:
url
+=
'?url='
+
urllib
.
quote_plus
(
redirect_url
)
url
+=
'&service='
+
urllib
.
quote_plus
(
redirect_url
)
url
+=
'?url='
+
urllib
.
quote_plus
(
redirect_url
.
encode
(
'utf8'
)
)
url
+=
'&service='
+
urllib
.
quote_plus
(
redirect_url
.
encode
(
'utf8'
)
)
return
url
def
validate_url
(
self
,
service
,
ticket
):
"""Return the validation URL for the given service. (For CAS 1.0)"""
url
=
self
.
server_url
+
self
.
validate_path
+
'?service='
+
urllib
.
quote_plus
(
service
)
+
'&ticket='
+
urllib
.
quote_plus
(
ticket
)
url
=
self
.
server_url
+
self
.
validate_path
+
'?service='
+
urllib
.
quote_plus
(
service
.
encode
(
'utf8'
)
)
+
'&ticket='
+
urllib
.
quote_plus
(
ticket
)
if
self
.
renew
:
url
+=
"&renew=true"
return
url
...
...
@@ -136,14 +137,14 @@ class CASAuth(BaseAuth):
if
self
.
ticket_path
and
request
.
method
==
'POST'
:
logoutRequest
=
request
.
form
.
get
(
'logoutRequest'
,
None
)
if
logoutRequest
is
not
None
:
sys
.
stderr
.
write
(
"Tentative de d
econnexion du CAS : %s
\n
"
%
logoutRequest
)
sys
.
stderr
.
write
(
"Tentative de d
éconnexion du CAS : %s
\n
"
%
logoutRequest
.
decode
(
'ascii'
,
'ignore'
)
)
self
.
cas
.
singlesignout
(
logout_user
,
logoutRequest
)
# valid ticket on CAS
if
ticket
and
ticket
.
startswith
(
'ST-'
):
valid
,
username
=
self
.
cas
.
validate_ticket
(
url
,
ticket
)
if
valid
:
sys
.
stderr
.
write
(
"Authentifi
a
ction de %s sur le CAS
\n
"
%
username
)
sys
.
stderr
.
write
(
"Authentifiction de %s sur le CAS
\n
"
%
username
)
u
=
user
.
User
(
request
,
auth_username
=
username
,
auth_method
=
self
.
name
)
# auto create user ?
if
self
.
create_user
:
...
...
wiki/auth/categorie_public.py
View file @
5a430b27
...
...
@@ -53,14 +53,14 @@ class PublicCategories(AnonymousAuth):
sys
.
stderr
.
write
(
"%r dans la page %r
\n
"
%
(
cat
,
p
.
path
[
1
:]))
return
True
else
:
sys
.
stderr
.
write
(
"categories is empty, searching in page body of %s
\n
"
%
p
.
path
[
1
:])
sys
.
stderr
.
write
(
"categories is empty, searching in page body of %s
\n
"
%
p
.
path
[
1
:]
.
encode
(
'utf8'
)
)
body
=
page
.
getPageText
()
for
cat
in
self
.
pub_cats
:
if
cat
in
body
:
sys
.
stderr
.
write
(
"%
r dans la page %r
\n
"
%
(
cat
,
p
.
path
[
1
:]
))
sys
.
stderr
.
write
(
"%
s dans la page %s
\n
"
%
(
cat
.
encode
(
'utf8'
),
p
.
path
[
1
:].
encode
(
'utf8'
)
))
return
True
sys
.
stderr
.
write
(
"%
r n'est pas dans la page %r, %r
\n
"
%
(
cat
,
p
.
path
[
1
:]
,
categories
))
sys
.
stderr
.
write
(
"%
s n'est pas dans la page %s, %r
\n
"
%
(
cat
.
encode
(
'utf8'
),
p
.
path
[
1
:].
encode
(
'utf8'
)
,
categories
))
return
False
...
...
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