Int he sample cauth provider for django, the incoming data in the 'd'
parameter is supposed to be the three parts required to do a SIV
decryption of it. But if somebody is sitting on an old link or ends up
going through history or something like that it can end up with just two
parameters since that's what the old version of the plugin uses. Instead
of crashing on that, give an error message so the user can just retry.
# Finally, check of we have a data package that tells us where to
# redirect the user.
if 'd' in data:
- (nonces, datas, tags) = data['d'][0].split('$')
+ splitdata = data['d'][0].split('$')
+ if len(splitdata) != 3:
+ return HttpResponse("Invalid login pass-through data received, likely because of an old link. Please try again.")
+ (nonces, datas, tags) = splitdata
decryptor = AES.new(
SHA256.new(settings.SECRET_KEY.encode('ascii')).digest()[:32],
AES.MODE_SIV,