Example #1
0
def record_login(address, timestamp=None):
    if not timestamp:
        timestamp = datetime.utcnow()
    if last_login():
        uci.set(previous_login_ip, uci.get(last_login_ip))
        uci.set(previous_login_timestamp, uci.get(last_login_timestamp))
    uci.set(last_login_timestamp, timestamp.strftime('%Y-%m-%dT%H:%M:%S'))
    uci.set(last_login_ip, address)

    uci.commit("openwireless")
Example #2
0
def record_login(address, timestamp = None):
    if not timestamp:
        timestamp = datetime.utcnow()
    if last_login():
        uci.set(previous_login_ip, uci.get(last_login_ip))
        uci.set(previous_login_timestamp, uci.get(last_login_timestamp))
    uci.set(last_login_timestamp, timestamp.strftime('%Y-%m-%dT%H:%M:%S'))
    uci.set(last_login_ip, address)

    uci.commit("openwireless")
Example #3
0
def enabled(index):
    return uci.get("wireless.@wifi-iface[%d].disabled" % index) != "1"
Example #4
0
def _get_date(key):
    date_string = uci.get(key)
    return date_string and datetime.strptime(date_string, '%Y-%m-%dT%H:%M:%S')
Example #5
0
def previous_login():
    address = uci.get(previous_login_ip)
    timestamp = _get_date(previous_login_timestamp)
    return _build_login(address, timestamp)
Example #6
0
def last_login():
    address = uci.get(last_login_ip)
    timestamp = _get_date(last_login_timestamp)
    return _build_login(address, timestamp)
Example #7
0
def _get_date(key):
    date_string = uci.get(key)
    return date_string and datetime.strptime(date_string, '%Y-%m-%dT%H:%M:%S')
Example #8
0
def previous_login():
    address = uci.get(previous_login_ip)
    timestamp = _get_date(previous_login_timestamp)
    return _build_login(address, timestamp)
Example #9
0
def last_login():
    address = uci.get(last_login_ip)
    timestamp = _get_date(last_login_timestamp)
    return _build_login(address, timestamp)
def enabled(index):
    return uci.get("wireless.@wifi-iface[%d].disabled" % index) != "1"