コード例 #1
0
def settings():
    if is_signed_in(current_user) is True:
        return html_renderer.get_html(title='Settings',
                                      template='settings.html',
                                      user=current_user)
    else:
        return is_signed_in(current_user)
コード例 #2
0
def hosts():
    if is_signed_in(current_user) is True:
        return html_renderer.get_html(template='hosts.html',
                                      title='List of hosts',
                                      user=current_user,
                                      hosts=host_management.get_info('host'))
    else:
        return is_signed_in(current_user)
コード例 #3
0
def login():
    form = request.form
    if request.method == 'POST':
        user = form['username']
        password = form['password']
        if not common_tools.test_auth(user, password):
            flash('Invalid username or password')
            return redirect(url_for('login'))
        login_user(User(user))
        # return redirect(url_for('index'))
        return redirect(url_for('login'))
    return html_renderer.get_html(template='login.html',
                                  title='Sign In',
                                  user=current_user)
コード例 #4
0
def edit_host(mac_address):
    if is_signed_in(current_user) is True:
        if request.method == 'POST':
            description = request.form['description']
            mac = request.form['mac']
            script = request.form['ipxe-script'].split('\r\n')
            host_management.update_host(mac, mac, 'mac')
            host_management.update_host(mac, script, 'ipxe-script')
            host_management.update_host(mac, description, 'description')
            return redirect(url_for('hosts'))
        else:
            return html_renderer.get_html(template='edit_host.html',
                                          hosts=host_management.get_info(
                                              'host', mac=mac_address))
    else:
        return is_signed_in(current_user)
コード例 #5
0
def index():
    return html_renderer.get_html(title='Index',
                                  template='index.html',
                                  user=current_user)