diff --git a/authapi/api/fixtures/saas.json b/authapi/api/fixtures/saas.json index 9b651c0c..63f2a7c7 100644 --- a/authapi/api/fixtures/saas.json +++ b/authapi/api/fixtures/saas.json @@ -14,6 +14,15 @@ "fields": { "census": "open", "extra_fields": [ + { + "name":"tlf", + "min":2, + "unique":true, + "max":200, + "type":"tlf", + "required":true, + "required_on_authentication":true + }, { "name":"Email", "min":2, diff --git a/authapi/authmethods/m_emailpwd.py b/authapi/authmethods/m_emailpwd.py index c8560dd1..ecd65174 100644 --- a/authapi/authmethods/m_emailpwd.py +++ b/authapi/authmethods/m_emailpwd.py @@ -169,7 +169,6 @@ def authenticate_error(self, error, req, ae): def authenticate(self, auth_event, request, mode='authenticate'): d = {'status': 'ok'} req = json.loads(request.body.decode('utf-8')) - password = req.get('password', '') msg = "" msg += check_fields_in_request(req, auth_event, 'authenticate') diff --git a/authapi/authmethods/utils.py b/authapi/authmethods/utils.py index ad2a5b61..3c3adb67 100644 --- a/authapi/authmethods/utils.py +++ b/authapi/authmethods/utils.py @@ -771,20 +771,6 @@ def get_cannonical_tlf(tlf): def edit_user(user, req, auth_event): - if auth_event.auth_method == 'user-and-password': - req.pop('username') - req.pop('password') - elif auth_event.auth_method == 'email-and-password': - req.pop('email') - req.pop('password') - - if req.get('email'): - user.email = req.get('email') - req.pop('email') - if req.get('tlf'): - user.userdata.tlf = get_cannonical_tlf(req['tlf']) - req.pop('tlf') - if auth_event.extra_fields: for extra in auth_event.extra_fields: if extra.get('type') not in req: @@ -975,7 +961,7 @@ def post_verify_fields_on_auth(user, req, auth_event): for field in auth_event.extra_fields: if not field.get('required_on_authentication'): continue - + # Raise exception if a required field is not provided. # It will be catched by parent as an error. if field.get('name') not in req: