Exemple #1
0
def authenticate():
    if not request.is_json:
        abort(400)
    dispacher = Dispacher(config)
    response = dispacher.authenticate(request.get_json())
    print(request.get_json())
    return get_json_response(response)
Exemple #2
0
                    '-n',
                    help='New password',
                    action='store')
parser.add_argument('--edit', '-e', help='Edit', action='store_true')
parser.add_argument('--delete', '-d', help='Delete user', action='store_true')
parser.add_argument('--list',
                    '-l',
                    help='List of user or massages',
                    action='store_true')
parser.add_argument('--send', '-s', help='Send', action='store')
parser.add_argument('--to', '-t', help='Address of message', action='store')

if __name__ == '__main__':
    args = parser.parse_args()
    print(args)
    dispacher = Dispacher()

    salt = generate_salt()
    connection = create_connection()
    cursor = get_cursor(connection)

    option_handler = OptionsHandler(args.password, args.username,
                                    args.new_password, args.edit, args.delete,
                                    args.list, args.send, args.to)

    if option_handler.create_user:
        print(dispacher.create_user(args.username, args.password))
    elif option_handler.list_all_users:
        print(dispacher.print_all_users())
    elif option_handler.list_all_messages_for_user:
        print(dispacher.list_messages_to_user(args.username, args.password))
Exemple #3
0
                    '-n',
                    help='New password',
                    action='store')
parser.add_argument('--edit', '-e', help='Edit', action='store_true')
parser.add_argument('--delete', '-d', help='Delete user', action='store_true')
parser.add_argument('--list',
                    '-l',
                    help='List of user or massages',
                    action='store_true')
parser.add_argument('--send', '-s', help='Send', action='store')
parser.add_argument('--to', '-t', help='Address of message', action='store')

if __name__ == '__main__':
    args = parser.parse_args()
    print(args)
    dispacher = Dispacher()

    option_handler = OptionsHandler(args.username, args.password,
                                    args.new_password, args.edit, args.delete,
                                    args.list, args.send, args.to)

    if option_handler.create_user:
        result = dispacher.login_user(args.username, args.password)
        if result[1] == 1:
            dispacher.create_user(args.username, args.password)
            print('User {} created'.format(args.username))

    elif option_handler.list_all_users:
        if dispacher.all_users_list():
            print('All users list')
Exemple #4
0
from logic_handler import OptionsHandler

parser = argparse.ArgumentParser(description='Program options')
parser.add_argument('--username', '-u', help='Login - user email', action='store')
parser.add_argument('--password', '-p', help='User password', action='store')
parser.add_argument('--new-password', '-n', help='New password', action='store')
parser.add_argument('--edit', '-e', help='Edit', action='store_true')
parser.add_argument('--delete', '-d', help='Delete user', action='store_true')
parser.add_argument('--list', '-l', help='List of user or massages', action='store_true')
parser.add_argument('--send', '-s', help='Send', action='store')
parser.add_argument('--to', '-t', help='Address of message', action='store')

if __name__ == '__main__':
    args = parser.parse_args()
    print(args)
    dispacher = Dispacher()

    option_handler = OptionsHandler(
        args.password, args.username, args.new_password, args.edit, args.delete, args.list, args.send, args.to
    )

    if option_handler.create_user:
        # dispacher.create_user(args.username, args.password)
        print('User Created')
    elif option_handler.list_all_users:
        print('All users list')
    elif option_handler.list_all_messages_for_user:
        print('All messages for user')
    elif option_handler.change_password:
        print('Password Changed!')
    elif option_handler.send_message:
Exemple #5
0
                    '-n',
                    help='New password',
                    action='store')
parser.add_argument('--edit', '-e', help='Edit', action='store_true')
parser.add_argument('--delete', '-d', help='Delete user', action='store_true')
parser.add_argument('--list',
                    '-l',
                    help='List of user or massages',
                    action='store_true')
parser.add_argument('--send', '-s', help='Send', action='store')
parser.add_argument('--to', '-t', help='Address of message', action='store')

if __name__ == '__main__':
    args = parser.parse_args()
    print(args)
    dispacher = Dispacher()

    option_handler = OptionsHandler(args.password, args.username,
                                    args.new_password, args.edit, args.delete,
                                    args.list, args.send, args.to)

    if option_handler.create_user:
        print('User Created')
    elif option_handler.list_all_users:
        print('All users list')
    elif option_handler.list_all_messages_for_user:
        print('All messages for user')
    elif option_handler.change_password:
        print('Password Changed!')
    elif option_handler.send_message:
        print('Message send from user to user with txt')