def wifi(): form = wifiForm() if request.method == "GET": return render_template("wifi.html", form=form) elif request.method == "POST": if form.validate(): ssid = form.ssid.data.rsplit("-", 1)[0] psk = form.psk.data add_wifi(ssid, psk) time.sleep(5) if internet_status() is True: restart_vpn() time.sleep(5) flash("Wifi settings saved! VPN Restarted!", "success") return redirect(url_for("status")) else: flash("Error! Cannot reach the internet...", "error") return render_template("wifi.html", form=form) else: flash("Error! " + str(form.data), "error") return render_template("wifi.html", form=form)
def wifi(): form = wifiForm() if(request.method == "GET"): return render_template("wifi.html", form=form) elif(request.method == "POST"): if(form.validate()): ssid = (form.ssid.data).rsplit("-", 1)[0] psk = form.psk.data add_wifi(ssid, psk) time.sleep(5) if(internet_status() == True): restart_vpn() time.sleep(5) flash("Wifi settings saved! VPN Restarted!", "success") return redirect(url_for("status")) else: flash("Error! Cannot reach the internet...", "error") return render_template("wifi.html", form=form) else: flash("Error! " + str(form.data), "error") return render_template("wifi.html", form=form)
def initial_setup(): form = initialSetupForm() if request.method == "GET": return render_template("initial_setup.html", form=form) elif request.method == "POST": if form.validate(): ssid = form.ssid.data.rsplit("-", 1)[0] psk = form.psk.data add_wifi(ssid, psk) if internet_status() is True: vpn_server = form.vpn_server.data user_id = form.user_id.data user_psk = form.user_psk.data set_vpn_params(vpn_server, user_id, user_psk) restart_vpn() flash("Wifi and VPN settings saved!", "success") return redirect(url_for("status")) else: flash("Error! Cannot reach the internet...", "error") return render_template("initial_setup.html", form=form) else: flash("Error! " + str(form.data), "error") return render_template("initial_setup.html", form=form)
def initial_setup(): form = initialSetupForm() if(request.method == "GET"): return render_template("initial_setup.html", form=form) elif(request.method == "POST"): if(form.validate()): ssid = (form.ssid.data).rsplit("-", 1)[0] psk = form.psk.data add_wifi(ssid, psk) if(internet_status() == True): vpn_server = form.vpn_server.data user_id = form.user_id.data user_psk = form.user_psk.data set_vpn_params(vpn_server, user_id, user_psk) restart_vpn() flash("Wifi and VPN settings saved!", "success") return redirect(url_for("status")) else: flash("Error! Cannot reach the internet...", "error") return render_template("initial_setup.html", form=form) else: flash("Error! " + str(form.data), "error") return render_template("initial_setup.html", form=form)