mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-14 20:18:02 +00:00
In order to fix the reoccuring issue that OpenID users have to add several different OpenID variations, we'll save the usual variations now in different digest fields -> should ease the pain a lot
This commit is contained in:
@@ -11,3 +11,25 @@ def random_string(length=10):
|
||||
'''
|
||||
return ''.join(random.SystemRandom().choice(
|
||||
string.ascii_lowercase + string.digits) for _ in range(length))
|
||||
|
||||
|
||||
def openid_variations(openid):
|
||||
'''
|
||||
Return the various OpenID variations, ALWAYS in the same order:
|
||||
- http w/ trailing slash
|
||||
- http w/o trailing slash
|
||||
- https w/ trailing slash
|
||||
- https w/o trailing slash
|
||||
'''
|
||||
|
||||
# Make the 'base' version: http w/ trailing slash
|
||||
if openid.startswith('https://'):
|
||||
openid = openid.replace('https://', 'http://')
|
||||
if openid[-1] != '/':
|
||||
openid = openid + '/'
|
||||
|
||||
# http w/o trailing slash
|
||||
var1 = openid[0:-1]
|
||||
var2 = openid.replace('http://', 'https://')
|
||||
var3 = var2[0:-1]
|
||||
return (openid, var1, var2, var3)
|
||||
|
||||
Reference in New Issue
Block a user