def reset_password(): user = User.by_email(request_data().get('email')) if user is None: message = {'email': 'This email address is not linked to a user.'} return jsonify({'status': 400, 'errors': message}, status=400) send_reset_link(user) return jsonify({'status': 200})
def login(): data = request_data() user = User.by_email(data.get('email')) if user is not None and user.verify(data.get('password')): login_user(user, remember=True) return jsonify({'status': 200, 'user': user}) message = {'password': '******'} return jsonify({'status': 400, 'errors': message}, status=400)