예제 #1
0
파일: web.py 프로젝트: AlinaKay/Flexget
def do_cli(manager, options, session=None):
    if options.action == 'passwd':
        try:
            change_password(password=options.password, session=session)
        except WeakPassword as e:
            console(e.value)
            return
        console('Updated password')

    if options.action == 'gentoken':
        token = generate_token(session=session)
        console('Generated new token %s' % token)

    if options.action == 'showtoken':
        user = get_user()
        console('Token: %s' % user.token)
예제 #2
0
파일: users.py 프로젝트: Marmau/Flexget
def do_cli(manager, options, session=None):
    if hasattr(options, 'user'):
        options.user = options.user.lower()

    if options.action == 'passwd':
        user = user_exist(name=options.user, session=session)
        if not user:
            console('User %s does not exist' % options.user)
            return
        try:
            change_password(user_name=user.name, password=options.password, session=session)
        except WeakPassword as e:
            console(e.value)
            return
        console('Updated password for user %s' % options.user)

    if options.action == 'gentoken':
        user = user_exist(name=options.user, session=session)
        if not user:
            console('User %s does not exist' % options.user)
            return
        user = generate_token(user_name=user.name, session=session)
        console('Generated new token for user %s' % user.name)
        console('Token %s' % user.token)
예제 #3
0
파일: user.py 프로젝트: AlinaKay/Flexget
 def get(self, session=None):
     """ Change current user token """
     token = generate_token(username=current_user.name, session=session)
     return {'token': token}
예제 #4
0
파일: user.py 프로젝트: umeku/Flexget
 def get(self, session=None):
     """ Change current user token """
     token = generate_token(username=current_user.name, session=session)
     return {'token': token}