def post(self):
        """
        Login mechanism, using POST.
        Supply the following in the body: {"user": "xxx", "password": "xxx"}

        """
        try:
            marsh_schema = parse_json_schema().load(request.json)
            args = marsh_schema
        except ValidationError as errors:
            logger.debug('Validation error: {}'.format(errors))
            return errors.messages, 500
        if CRACK_CONF['auth']['type'] == 'ldap':
            username = args['user']
            password = args['password']
            if not username:
                return jsonify({"msg": "Missing username parameter"}), 400
            if not password:
                return jsonify({"msg": "Missing password parameter"}), 400
            ldap_uri = CRACK_CONF['auth']['ldap_server']
            ldap_base = CRACK_CONF['auth']['ldap_base']
            auther = auth.Ldap()
            authn = auther.authenticate(ldap_uri, username, password,
                                        ldap_base=ldap_base)
            logger.debug('LDAP reply: {}'.format(authn))
            if authn[0] == "Success":
                logger.debug('Authenticated: {}'.format(username))
                user = load_user(username)
                if user:
                    crackq.app.session_interface.regenerate(session)
                    login_user(user)
                else:
                    if len(authn) > 1:
                        email = authn[1]
                    else:
                        email = username
                    if email_check(email):
                        logger.debug('Email address found, using for notify')
                        create_user(username, email=email)
                    else:
                        create_user(username)
                    user = load_user(username)
                if isinstance(user, User):
                    crackq.app.session_interface.regenerate(session)
                    login_user(user)
                else:
                    logger.error('No user object loaded')
                    return jsonify(ERR_BAD_CREDS), 401
                return 'OK', 200
            elif authn[0] == "Invalid Credentials":
                return jsonify(ERR_BAD_CREDS), 401
            else:
                logger.debug('Login error: {}'.format(authn))
                return jsonify(ERR_BAD_CREDS), 401
        if CRACK_CONF['auth']['type'] == 'sql':
            user = User.query.filter_by(username=args['user']).first()
            if isinstance(user, User):
                if bcrypt.check_password_hash(user.password, args['password']):
                    crackq.app.session_interface.regenerate(session)
                    login_user(user)
                    return 'OK', 200
            return jsonify(ERR_BAD_CREDS), 401
        else:
            return jsonify(ERR_METH_NOT)

        Login mechanism, using POST.
        Supply the following in the body: {"user": "xxx", "password": "xxx"}

        
crackq/cq_api.py