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)
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)
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)
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)
def index(): return html_renderer.get_html(title='Index', template='index.html', user=current_user)