<commit_before>import logging
from flask import jsonify, make_response
from flask_restful import Resource, reqparse

from app.models import User
from app.common.db import save_record
from app.common.auth.token import JWT

logger = logging.getLogger(__name__)


class LoginResource(Resource):
    """ This class handles authentication of users. """
    def __init__(self):
        self.parser = reqparse.RequestParser()
        self.parser.add_argument("username",
                                 type=str,
                                 required=True,
                                 help="username is required",
                                 location="json")

        self.parser.add_argument("password",
                                 type=str,
                                 required=True,
                                 help="password is required",
                                 location="json")

    def post(self):
        """ This function handles post requests. """

        args = self.parser.parse_args()
        username = args.get("username").strip()
        password = args.get("password").strip()

        if any(arg == "" for arg in [username, password]):
            response = ("message", "username and password is required", 400)
        else:
            user = User.query.filter_by(username=username).first()
            if user:<commit_msg>[FIX] Change status message for register method<commit_after>import logging
from flask import jsonify, make_response
from flask_restful import Resource, reqparse

from app.models import User
from app.common.db import save_record
from app.common.auth.token import JWT

logger = logging.getLogger(__name__)


class LoginResource(Resource):
    """ This class handles authentication of users. """
    def __init__(self):
        self.parser = reqparse.RequestParser()
        self.parser.add_argument("username",
                                 type=str,
                                 required=True,
                                 help="username is required",
                                 location="json")

        self.parser.add_argument("password",
                                 type=str,
                                 required=True,
                                 help="password is required",
                                 location="json")

    def post(self):
        """ This function handles post requests. """

        args = self.parser.parse_args()
        username = args.get("username").strip()
        password = args.get("password").strip()

        if any(arg == "" for arg in [username, password]):
            response = ("failed", "username and password is required", 400)
        else:
            user = User.query.filter_by(username=username).first()
            if user:
{'fraction_non_alphanumeric': 0.09544312881234301, 'fraction_numerical': 0.002152852529601722, 'mean_word_length': 1.6989351403678605, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7370078', 'n_tokens_mistral': 647, 'n_tokens_neox': 623, 'n_words': 175}