Theme_voucher - Bypass terms of service check box

I use this script

but I need to bypass terms of service check box

I modify

login_with_voucher()
{
		voucher_validation
		footer
}

but it go to invalid voucher page direct and keep on it

also I want to add a photo in background
So I modify

header() 
<style>body {
		background: url("/images/background.jpg") no-repeat center center fixed;
		background-size: cover;
		color: #140f07; /* text color */
		margin: 0;
		padding: 10px;
		direction: rtl;
		text-align:center;
		font-family: sans-serif;
	}

but background becomes white without photo
I try ==> routerIP\images\background.jpg in browser ad it open the
background.jpg photo correctly

please help ??

If this is a public system, to protect yourself legally (in just about any country), you must get acceptance of the Terms of Service. It is there for a reason.

The captive portal always displays a sequence of login pages, depending on the theme chosen. You cannot just remove part of the sequence without changing the logic. Deleting lines from the script is not the way to do it.

If you really want to skip reading the ToS,it is very simple.
Just set the ToS variable to "accepted"

Look for the function generate_splash_sequence ()

This is what it looks like:

generate_splash_sequence() {
	login_with_voucher
}

Add another line to make it look like this:

generate_splash_sequence() {
	tos="accepted"
	login_with_voucher
}

Theme scripts contain embedded html. This must be escaped to be compatible with ash shell scripts.

You have broken the function header() by adding un-escaped html making the whole theme script fail with ash shell syntax errors.

The function header() looks like this in the unmodified script:

header() {
# Define a common header html for every page served
	gatewayurl=$(printf "${gatewayurl//%/\\x}")
	echo "<!DOCTYPE html>
		<html>
		<head>
		<meta http-equiv=\"Cache-Control\" content=\"no-cache, no-store, must-revalidate\">
		<meta http-equiv=\"Pragma\" content=\"no-cache\">
		<meta http-equiv=\"Expires\" content=\"0\">
		<meta charset=\"utf-8\">
		<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
		<link rel=\"shortcut icon\" href=\"/images/splash.jpg\" type=\"image/x-icon\">
		<link rel=\"stylesheet\" type=\"text/css\" href=\"/splash.css\">
		<title>$gatewayname</title>
		</head>
		<body>
		<div class=\"offset\">
		<div class=\"insert\" style=\"max-width:100%;\">
	"
}

The embedded html begins with an echo command.
Note the "double-quotes" normally found in html have meaning in an ash script, so the \ is used to "escape" the quotes.
For example, the html:
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">

becomes:
<meta http-equiv=\"Cache-Control\" content=\"no-cache, no-store, must-revalidate\">

Your modified header() has lost its echo command and is broken.

To add a background, it would be far simpler just to edit the splash.css file. This is a standard css format and does not need escaping.

The default body style is:

	body {
		background-color: lightgrey;
		color: #140f07;
		margin: 0;
		padding: 10px;
		font-family: sans-serif;
	}

All you have to do is edit splash.css to suit your requirements.

many thanks to bluewavenet
you are right

I need to find the condition that check for speed, time and other variables then disconnect from internet ( location in the script ) as I want to modify it to cut after consuming 500mb for example ??

These are config options:
https://opennds.readthedocs.io/en/stable/traffic.html#data-quotas-and-traffic-shaping

Note that these can be defined in the voucher, per client. You do not need to modify any code as far as I am aware.

Voucher Specifications:
voucher code, speed limit down, speed limit up, quota down, quota up, voucher validity (minutes), 0 (placeholder for when voucher is used)

when I set values for test as ==> 8YAN-PSY9,1024 ,1024 ,10000 ,8000 ,1440 ,0 I notice that when I consumes 10mb the client logged out but voucher code still valid and you can login again with it.

I change Fair Usage Policy Throttle Rate in configuration file : to
option fup_upload_throttle_rate '0'
option fup_download_throttle_rate '0'
so that a client exceeds 10mb should be deauthenticated
but nothing changed

how to set quota down value so that If a client exceeds 10mb should be deauthenticated and voucher code should becomes invalid ??

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.