Пример #1
0
    def mysql_login(self, user, pwd):
        enc_pwd = encode(pwd)
        admin = self.db.find_first_object_by(User, name=user, password=enc_pwd)
        if admin is None:
            log.warn("invalid user/pwd login: user=%s, encoded pwd=%s" % (user, enc_pwd))
            return None

        token = self.__generate_api_token(admin)
        return {"token": token, "admin": admin}
Пример #2
0
    def mysql_login(self, user, pwd):
        enc_pwd = encode(pwd)
        admin = self.db.find_first_object_by(User, name=user, password=enc_pwd)
        if admin is None:
            log.warn("invalid user/pwd login: user=%s, encoded pwd=%s" %
                     (user, enc_pwd))
            return None

        token = self.__generate_api_token(admin)
        return {"token": token, "admin": admin}
Пример #3
0
    def login(self, args):
        """ mysql Login

        :type args: dict
        :param args:

        :rtype: dict
        :return: token and instance of user
        """

        user = request.form['username']
        pwd = request.form['password']
        if user is None or pwd is None:
            log.warn("login without user or pwd")
            return None

        return user_manager.mysql_login(user, pwd)
Пример #4
0
    def login(self, args):
        """ mysql Login

        :type args: dict
        :param args:

        :rtype: dict
        :return: token and instance of user
        """

        user = request.form['username']
        pwd = request.form['password']
        if user is None or pwd is None:
            log.warn("login without user or pwd")
            return None

        return user_manager.mysql_login(user, pwd)