2018-01-02 17:06:12 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from allauth.account.adapter import DefaultAccountAdapter
|
2018-04-22 15:31:41 +02:00
|
|
|
from allauth_ens.adapter import LongTermClipperAccountAdapter
|
2018-01-02 17:06:12 +01:00
|
|
|
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
|
|
|
|
|
|
|
|
class AccountAdapter(DefaultAccountAdapter):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2018-04-22 15:31:41 +02:00
|
|
|
class SocialAccountAdapter(LongTermClipperAccountAdapter):
|
2018-04-29 01:28:09 +02:00
|
|
|
|
|
|
|
def get_username(self, clipper, data):
|
|
|
|
"""
|
|
|
|
Exception-free version of get_username, so that it works even outside of
|
|
|
|
the ENS (if no access to LDAP server)
|
|
|
|
"""
|
2018-06-19 19:15:25 +02:00
|
|
|
return "{}@{}".format(clipper, data.get('entrance_year', '00'))
|