def login(): """Allows a user to log in on Genocrowd Returns ------- user info in json format """ data = request.get_json() local_auth = LocalAuth(ca, session) result = local_auth.authenticate_user(data) if result["user"] != {}: if result["user"]['blocked']: result = { 'error': True, 'errorMessage': ["Your account is blocked"], 'user': {} } else: session['user'] = result['user'] return kill_apollo_session(result)
def login(): """Log a user Returns ------- json Information about the logged user """ data = request.get_json() local_auth = LocalAuth(current_app, session) authentication = local_auth.authenticate_user(data) user = {} if not authentication['error']: session['user'] = authentication['user'] user = authentication['user'] return jsonify({ 'error': authentication['error'], 'errorMessage': authentication['error_messages'], 'user': user })