From c1c33bd6daf2d27494f23d9867f1c181bfa694e9 Mon Sep 17 00:00:00 2001 From: Christian Wieninger Date: Mon, 4 Jun 2007 16:40:15 +0000 Subject: - check for login/password before saving setup (#351) --- i18n.cpp | 22 ++++++++++++++++++++++ pages/setup.ecpp | 34 ++++++++++++++++++++++------------ 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/i18n.cpp b/i18n.cpp index 0ec0a88..aa94135 100644 --- a/i18n.cpp +++ b/i18n.cpp @@ -4143,6 +4143,28 @@ const tI18nPhrase Phrases[] = { "", // Dansk "", // Czech }, + { "Please set login and password!", // English + "Bitte Login und Passwort angeben!", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "", // Finnish + "", // Polski + "", // Español + "", // Greek + "", // Svenska + "", // Românã + "", // Magyar + "", // Català + "", // Russian + "", // Hrvatski + "", // Eesti + "", // Dansk + "", // Czech + }, /* { "", // English "", // Deutsch diff --git a/pages/setup.ecpp b/pages/setup.ecpp index 43c0de8..88ea00d 100644 --- a/pages/setup.ecpp +++ b/pages/setup.ecpp @@ -27,20 +27,27 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); <%cpp> #define SELECTIF(x) reply.out() << ( (x) ? "selected=\"selected\"" : "" ); + std::string message; + if ( request.getMethod() == "POST") { - LiveSetup().SetLastChannel(lastchannel != "" ? lexical_cast< int >(lastchannel):0); - LiveSetup().SetUseAuth(useauth); - if (useauth) { - LiveSetup().SetAdminLogin(login); - if (pass != "") - LiveSetup().SetAdminPassword(pass); - LiveSetup().SetLocalNetMask(localnetmask); - LiveSetup().CheckLocalNet(request.getPeerIp()); + if (useauth && (login.empty() || pass.empty())) + message = tr("Please set login and password!"); + else + { + LiveSetup().SetLastChannel(lastchannel != "" ? lexical_cast< int >(lastchannel):0); + LiveSetup().SetUseAuth(useauth); + if (useauth) { + LiveSetup().SetAdminLogin(login); + if (pass != "") + LiveSetup().SetAdminPassword(pass); + LiveSetup().SetLocalNetMask(localnetmask); + LiveSetup().CheckLocalNet(request.getPeerIp()); + } + LiveSetup().SetTimes(times); + LiveSetup().SetStartScreen(startscreen); + LiveSetup().SetTheme(theme); + LiveSetup().SaveSetup(); } - LiveSetup().SetTimes(times); - LiveSetup().SetStartScreen(startscreen); - LiveSetup().SetTheme(theme); - LiveSetup().SaveSetup(); } pageTitle = tr("Setup"); int ilastchannel = LiveSetup().GetLastChannel(); @@ -167,6 +174,9 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); +
+ <$ message $> +
-- cgit v1.2.3