Exemplo n.º 1
0
        usage()
        sys.exit(1)

    if not user_id:
        print("No user_id provided!")
        sys.exit(1)

    (configuration, username, full_name, addresses, errors) = \
        user_migoid_notify(user_id, raw_targets, conf_path, db_path, verbose,
                           admin_copy)

    if errors:
        print("Address lookup errors:")
        print('\n'.join(errors))

    if not addresses:
        print("Error: found no suitable addresses")
        sys.exit(1)
    if not username:
        print("Error: found no username")
        sys.exit(1)
    logger = configuration.logger
    notify_dict = {'JOB_ID': 'NOJOBID', 'USER_CERT': user_id, 'NOTIFY': []}
    for (proto, address_list) in addresses.items():
        for address in address_list:
            notify_dict['NOTIFY'].append('%s: %s' % (proto, address))
    print("Sending internal OpenID account intro for '%s' to:\n%s" % \
          (user_id, '\n'.join(notify_dict['NOTIFY'])))
    notify_user(notify_dict, [user_id, username, full_name], 'ACCOUNTINTRO',
                logger, '', configuration)
Exemplo n.º 2
0
            continue

        print("Added peer request from %s to %s" % (peer_id, user_id))

        (_, _, full_name, addresses,
         errors) = user_account_notify(user_id, raw_targets, conf_path,
                                       db_path, verbose, admin_copy)
        if errors:
            print("Address lookup errors for %s :" % user_id)
            print('\n'.join(errors))
            exit_code += 1
            continue

        notify_dict = {'JOB_ID': 'NOJOBID', 'USER_CERT': user_id, 'NOTIFY': []}
        for (proto, address_list) in addresses.items():
            for address in address_list:
                notify_dict['NOTIFY'].append('%s: %s' % (proto, address))
        # Don't actually send unless requested
        if not raw_targets and not admin_copy:
            print("No email targets for request accept peer %s from %s" %
                  (peer_id, user_id))
            continue
        print("Send request accept peer message for '%s' to:\n%s" %
              (peer_id, '\n'.join(notify_dict['NOTIFY'])))
        notify_user(notify_dict, [
            peer_id, configuration.short_title, 'peeraccount',
            peer_dict['comment'], peer_dict['email'], user_id
        ], 'SENDREQUEST', logger, '', configuration)

    sys.exit(exit_code)
Exemplo n.º 3
0
                print("Skip account %s without local password" % user_id)
            continue

        (_, username, full_name, addresses,
         errors) = user_migoid_notify(user_id, raw_targets, conf_path, db_path,
                                      verbose, admin_copy)
        if errors:
            print("Address lookup errors for %s :" % user_id)
            print('\n'.join(errors))
            exit_code += 1
            continue
        if not username:
            print("Error: found no username for %s" % user_id)
            exit_code += 1
            continue
        expire = datetime.datetime.fromtimestamp(user_dict['expire'])
        print("Account %s expires on %s" % (user_id, expire))
        notify_dict = {'JOB_ID': 'NOJOBID', 'USER_CERT': user_id, 'NOTIFY': []}
        for (proto, address_list) in addresses.items():
            for address in address_list:
                notify_dict['NOTIFY'].append('%s: %s' % (proto, address))
        # Don't actually send unless requested
        if not raw_targets and not admin_copy:
            continue
        print("Send internal OpenID account expire warning for '%s' to:\n%s" \
              % (user_id, '\n'.join(notify_dict['NOTIFY'])))
        notify_user(notify_dict, [user_id, username, full_name, user_dict],
                    'ACCOUNTEXPIRE', logger, '', configuration)

    sys.exit(exit_code)
Exemplo n.º 4
0
    # Default to inform mail used in request
    raw_targets['email'].append(user_dict.get('email', keyword_auto))

    # Now all user fields are set and we can reject and warn the user

    (configuration, addresses, errors) = \
        user_request_reject(user_id, raw_targets, conf_path,
                            db_path, verbose, admin_copy)

    if errors:
        print("Address lookup errors:")
        print('\n'.join(errors))

    if not addresses:
        print("Error: found no suitable addresses")
        sys.exit(1)
    logger = configuration.logger
    notify_dict = {'JOB_ID': 'NOJOBID', 'USER_CERT': user_id, 'NOTIFY': []}
    for (proto, address_list) in addresses.items():
        for address in address_list:
            notify_dict['NOTIFY'].append('%s: %s' % (proto, address))
    print("Sending reject account request for '%s' to:\n%s" %
          (user_id, '\n'.join(notify_dict['NOTIFY'])))
    notify_user(notify_dict, [user_id, user_dict, auth_type, reason],
                'ACCOUNTREQUESTREJECT', logger, '', configuration)

    if verbose:
        print('Cleaning up tmp file: %s' % user_file)
    os.remove(user_file)
Exemplo n.º 5
0
        usage()
        sys.exit(1)

    if not user_id:
        print("No user_id provided!")
        sys.exit(1)

    (configuration, password, addresses, errors) = \
        user_password_reminder(user_id, raw_targets, conf_path,
                               db_path, verbose)

    if errors:
        print("Address lookup errors:")
        print('\n'.join(errors))

    if not addresses:
        print("Error: found no suitable addresses")
        sys.exit(1)
    if not password:
        print("Error: found no password for user")
        sys.exit(1)
    logger = configuration.logger
    notify_dict = {'JOB_ID': 'NOJOBID', 'USER_CERT': user_id, 'NOTIFY': []}
    for (proto, address_list) in addresses.items():
        for address in address_list:
            notify_dict['NOTIFY'].append('%s: %s' % (proto, address))
    print("Sending password reminder(s) for '%s' to:\n%s" % \
          (user_id, '\n'.join(notify_dict['NOTIFY'])))
    notify_user(notify_dict, [user_id, password], 'PASSWORDREMINDER', logger,
                '', configuration)