diff --git a/src/freedombone-installer b/src/freedombone-installer index 4d922223bb1d88e7aa6d50bc39764dfa3137e673..9255756c59e9f61e8f8f257d5957e420059147a2 100755 --- a/src/freedombone-installer +++ b/src/freedombone-installer @@ -112,6 +112,11 @@ do cp "$webadmin_install_dir/index.prev" "$webadmin_install_dir/setup_installing.html" fi + # Replace the setup confirm screen with the main index + if [ -f "$webadmin_install_dir/setup_confirm.html" ]; then + cp "$webadmin_install_dir/index.prev" "$webadmin_install_dir/setup_confirm.html" + fi + # set permissions for web admin site at freedombone.local chown www-data:www-data "$webadmin_install_dir/index.html" diff --git a/src/freedombone-utils-webadmin b/src/freedombone-utils-webadmin index df95a25e6d5973f6238a32195d3ca7c087e29ff8..ceb1ad906157ecb9d35a8bd8938c6d6bffddc92b 100755 --- a/src/freedombone-utils-webadmin +++ b/src/freedombone-utils-webadmin @@ -539,7 +539,9 @@ function web_admin_setup_login { # and copy it to the index cp "$webadmin_install_dir/index.html" "$webadmin_install_dir/index.prev" cp "$webadmin_install_dir/setup.html" "$webadmin_install_dir/setup.prev" + cp "$webadmin_install_dir/setup_confirm_template.html" "$webadmin_install_dir/setup_confirm.html" sed -i "s|WEBADMINPASSWORD|${webadmin_password}|g" "$webadmin_install_dir/setup.prev" + sed -i "s|WEBADMINPASSWORD|${webadmin_password}|g" "$webadmin_install_dir/setup_confirm.html" cp "$webadmin_install_dir/setup.prev" "$webadmin_install_dir/index.html" # if initial setup has not yet happened then create diff --git a/webadmin/EN/setup_confirm_template.html b/webadmin/EN/setup_confirm_template.html new file mode 100644 index 0000000000000000000000000000000000000000..70f4b750dad9d10192f33343fd078c9745a38215 --- /dev/null +++ b/webadmin/EN/setup_confirm_template.html @@ -0,0 +1,137 @@ +<!DOCTYPE html> +<html> + <head> + <meta http-equiv="Refresh" content="30"> + <style> + #headerpic { + width: 60%; + height: auto; + margin-right : auto; + margin-left : auto; + min-width : 220px; + } + + #welcomeicon { + width: 20%; + height: auto; + margin-right : auto; + margin-left : auto; + min-width : 100px; + } + + .header { + text-align: center; + padding: 32px; + } + + #iconpic { + width: 20%; + height: auto; + margin-right : auto; + margin-left : auto; + min-width : 120px; + } + + .card { + box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); + max-width: 600px; + margin: auto; + text-align: center; + font-family: arial; + clear: both; + } + + .card input[type=text] { + width: 90%; + clear: both; + text-align: center; + } + + .appurl { + color: grey; + font-size: 100%; + } + + .welcomeheader { + color: black; + font-size: 200%; + font-weight: bold; + } + + .welcometext { + color: black; + font-size: 90%; + } + + .logintext { + color: black; + font-size: 120%; + font-weight: bold; + color: #981737; + } + + button { + border: none; + outline: 0; + display: inline-block; + padding: 8px; + color: white; + background-color: #000; + text-align: center; + cursor: pointer; + width: 100%; + font-size: 18px; + } + + a { + text-decoration: none; + color: black; + } + + button:hover, a:hover { + opacity: 0.7; + } + + .chip { + display: inline-block; + padding: 0 25px; + height: 50px; + font-size: 70%; + line-height: 50px; + border-radius: 25px; + background-color: #f1f1f1; + } + + .chip img { + float: left; + margin: 0 10px 0 -25px; + height: 50px; + width: 50px; + border-radius: 50%; + } + </style> + </head> + <body> + <div class="card"> + <div class="header"> + <img id="headerpic" class="img-responsive" src="images/logo.png"><br> + <img id="welcomeicon" class="img-responsive" src="images/login.png"> + <p class="welcometext">Have you written down or saved the login credentials?</p> + + <p class="logintext">Username: admin<br> + Password: WEBADMINPASSWORD + </p> + + <br> + + <form action="setupconfirm.php" method="post"> + <p><input type="radio" name="setupconfirm" value="0" checked>No + <input type="radio" name="setupconfirm" value="1">Yes</p><br><br> + <input type="submit" name="setupconfirmsubmit" value="Continue" /> + </form> + + <br> + </div> + </div> + </body> +</html> diff --git a/webadmin/setup.php b/webadmin/setup.php index 8facfcf45e52dae43cc415c793673ecfef5c8766..960a034659cc55d301bdc0ad62cec9a819f21fbe 100755 --- a/webadmin/setup.php +++ b/webadmin/setup.php @@ -4,8 +4,8 @@ if (isset($_POST['setup'])) { $my_username = htmlspecialchars($_POST['my_username']); $default_domain_name = htmlspecialchars($_POST['default_domain_name']); - if(!file_exists("setup.txt")) { - $setup_file = fopen("setup.txt", "w") or die("Unable to create setup file"); + if(!file_exists(".temp_setup.txt")) { + $setup_file = fopen(".temp_setup.txt", "w") or die("Unable to create setup file"); fwrite($setup_file, $my_username.",".$default_domain_name."\n"); fclose($); } diff --git a/webadmin/setupconfirm.php b/webadmin/setupconfirm.php new file mode 100644 index 0000000000000000000000000000000000000000..168f4914522e362e959056f91c753c5b0ccb8536 --- /dev/null +++ b/webadmin/setupconfirm.php @@ -0,0 +1,24 @@ +<?php + +$output_filename = "index.html"; + +if (isset($_POST['setupconfirmsubmit'])) { + if(isset($_POST['setupconfirm'])) { + $confirm = htmlspecialchars($_POST['setupconfirm']); + + if($confirm == "1") { + if(file_exists(".temp_setup.txt")) { + exec('mv .temp_setup.txt setup.txt'); + } + if(file_exists("setup.txt")) { + $output_filename = "setup_installing.html"; + } + } + } +} + +$htmlfile = fopen("$output_filename", "r") or die("Unable to open $output_filename"); +echo fread($htmlfile,filesize("$output_filename")); +fclose($htmlfile); + +?>