diff --git a/app.py b/app.py index 39232d0..3dc9ed2 100644 --- a/app.py +++ b/app.py @@ -57,7 +57,10 @@ def get_index(): @get('/signup') def get_index(): newSession() - return signup_tpl(str=i18n.str) + if isOpen: + return signup_tpl(str=i18n.str) + else: + return index_tpl(alerts=[('error', i18n.msg[28], 'upDown')], str=i18n.str) @get('/change_pwd') def get_index(): @@ -807,6 +810,12 @@ def ldaps_count(): N = ldaps_count() +def reg(): + if CONF['general']['allow_registration'] == 'True': + return True + +isOpen = reg() + class Error(Exception): pass diff --git a/libs/localization.py b/libs/localization.py index 84256c0..4335c66 100644 --- a/libs/localization.py +++ b/libs/localization.py @@ -1,3 +1,4 @@ +import os import gettext class LocalizeTo(object): @@ -65,6 +66,7 @@ class LocalizeTo(object): msg_25 = _("Email already exists.") msg_26 = _("Forgot your password? Please try again.") msg_27 = _("The session has expired.") + msg_28 = _("Registration is currently closed. We apologize for the inconvenience.") self.str = {'usr':str_00, 'usrn':str_01, 'fn':str_02, 'sn':str_03, 'pwd':str_04, 'old-pwd':str_05, 'new-pwd':str_06, 'conf-pwd':str_07, 'email':str_08, 'edit':str_09, 'login':str_10, 'log-out':str_11, 'del':str_12, 'sign-up':str_13, 'back':str_14, 'update':str_15, 'or-sign-in':str_16, 'or-sign-up':str_17, 'inv-code':str_18, 'edit-fn':str_19, 'edit-email':str_20, 'ch-pwd':str_21, 'del-account':str_22, 'welcome':str_23, 'pwd-pattern': msg_08} - self.msg = (msg_00, msg_01, msg_02, msg_03, msg_04, msg_05, msg_06, msg_07, msg_08, msg_09, msg_10, msg_11, msg_12, msg_13, msg_14, msg_15, msg_16, msg_17, msg_18, msg_19, msg_20, msg_21, msg_22, msg_23, msg_24, msg_25, msg_26, msg_27) + self.msg = (msg_00, msg_01, msg_02, msg_03, msg_04, msg_05, msg_06, msg_07, msg_08, msg_09, msg_10, msg_11, msg_12, msg_13, msg_14, msg_15, msg_16, msg_17, msg_18, msg_19, msg_20, msg_21, msg_22, msg_23, msg_24, msg_25, msg_26, msg_27, msg_28) diff --git a/locales/base.pot b/locales/base.pot index 40847dd..8c10719 100644 --- a/locales/base.pot +++ b/locales/base.pot @@ -113,113 +113,117 @@ msgstr "" msgid "Welcome" msgstr "" -#: libs/localization.py:38 +#: libs/localization.py:40 msgid "The session was closed." msgstr "" -#: libs/localization.py:40 +#: libs/localization.py:42 msgid "Username must be at least 3 characters long!" msgstr "" -#: libs/localization.py:41 +#: libs/localization.py:43 msgid "Not allowed characters for the username field." msgstr "" -#: libs/localization.py:42 +#: libs/localization.py:44 msgid "Not allowed characters for the firstname field." msgstr "" -#: libs/localization.py:43 +#: libs/localization.py:45 msgid "Not allowed characters for the surname field." msgstr "" -#: libs/localization.py:44 +#: libs/localization.py:46 msgid "The code is invalid or has expired." msgstr "" -#: libs/localization.py:45 +#: libs/localization.py:47 msgid "Passwords do not match!" msgstr "" -#: libs/localization.py:46 +#: libs/localization.py:48 msgid "" "The password must contain at least 8 characters, at least one number, " "a capital letter and a special character." msgstr "" -#: libs/localization.py:47 +#: libs/localization.py:49 msgid "Congratulations, your account has been created!" msgstr "" -#: libs/localization.py:48 +#: libs/localization.py:50 msgid "Your first and last name have not been changed." msgstr "" -#: libs/localization.py:49 +#: libs/localization.py:51 msgid "Your firstname is a bit short, don't you think?" msgstr "" -#: libs/localization.py:50 +#: libs/localization.py:52 msgid "Your surname is a bit short, don't you think?" msgstr "" -#: libs/localization.py:51 +#: libs/localization.py:53 msgid "Your first and last name have been successfully updated." msgstr "" -#: libs/localization.py:52 +#: libs/localization.py:54 msgid "Invalid email address. Please try again." msgstr "" -#: libs/localization.py:53 +#: libs/localization.py:55 msgid "Email address has not been changed." msgstr "" -#: libs/localization.py:54 +#: libs/localization.py:56 msgid "Your email has been successfully updated." msgstr "" -#: libs/localization.py:55 +#: libs/localization.py:57 msgid "The password entered is the same as the current password." msgstr "" -#: libs/localization.py:56 +#: libs/localization.py:58 msgid "Password has been changed!" msgstr "" -#: libs/localization.py:57 +#: libs/localization.py:59 msgid "Please, type your username for account deletion." msgstr "" -#: libs/localization.py:58 +#: libs/localization.py:60 msgid "Account successfully deleted!" msgstr "" -#: libs/localization.py:59 +#: libs/localization.py:61 msgid "Username or password is incorrect!" msgstr "" -#: libs/localization.py:60 +#: libs/localization.py:62 msgid "Unable to connect to the remote server." msgstr "" -#: libs/localization.py:61 +#: libs/localization.py:63 msgid "" "Encountered an unexpected error while communicating with the remote server." msgstr "" -#: libs/localization.py:62 +#: libs/localization.py:64 msgid "User already exists." msgstr "" -#: libs/localization.py:63 +#: libs/localization.py:65 msgid "Email already exists." msgstr "" -#: libs/localization.py:64 +#: libs/localization.py:66 msgid "Forgot your password? Please try again." msgstr "" -#: libs/localization.py:65 +#: libs/localization.py:67 msgid "The session has expired." msgstr "" + +#: libs/localization.py:68 +msgid "Registration is currently closed. We apologize for the inconvenience." +msgstr "" \ No newline at end of file diff --git a/locales/en/LC_MESSAGES/base.mo b/locales/en/LC_MESSAGES/base.mo index 971d482..a26a2ba 100644 Binary files a/locales/en/LC_MESSAGES/base.mo and b/locales/en/LC_MESSAGES/base.mo differ diff --git a/locales/en/LC_MESSAGES/base.po b/locales/en/LC_MESSAGES/base.po index 499f018..bc0d35b 100644 --- a/locales/en/LC_MESSAGES/base.po +++ b/locales/en/LC_MESSAGES/base.po @@ -113,35 +113,35 @@ msgstr "Delete your account" msgid "Welcome" msgstr "Welcome" -#: libs/localization.py:38 +#: libs/localization.py:40 msgid "The session was closed." msgstr "The session was closed." -#: libs/localization.py:40 +#: libs/localization.py:42 msgid "Username must be at least 3 characters long!" msgstr "Username must be at least 3 characters long!" -#: libs/localization.py:41 +#: libs/localization.py:43 msgid "Not allowed characters for the username field." msgstr "Not allowed characters for the username field." -#: libs/localization.py:42 +#: libs/localization.py:44 msgid "Not allowed characters for the firstname field." msgstr "Not allowed characters for the firstname field." -#: libs/localization.py:43 +#: libs/localization.py:45 msgid "Not allowed characters for the surname field." msgstr "Not allowed characters for the surname field." -#: libs/localization.py:44 +#: libs/localization.py:46 msgid "The code is invalid or has expired." msgstr "The code is invalid or has expired." -#: libs/localization.py:45 +#: libs/localization.py:47 msgid "Passwords do not match!" msgstr "Passwords do not match!" -#: libs/localization.py:46 +#: libs/localization.py:48 msgid "" "The password must contain at least 8 characters, at least one number, " "a capital letter and a special character." @@ -149,80 +149,84 @@ msgstr "" "The password must contain at least 8 characters, at least one number, " "a capital letter and a special character." -#: libs/localization.py:47 +#: libs/localization.py:49 msgid "Congratulations, your account has been created!" msgstr "Congratulations, your account has been created!" -#: libs/localization.py:48 +#: libs/localization.py:50 msgid "Your first and last name have not been changed." msgstr "Your first and last name have not been changed." -#: libs/localization.py:49 +#: libs/localization.py:51 msgid "Your firstname is a bit short, don't you think?" msgstr "Your firstname is a bit short, don't you think?" -#: libs/localization.py:50 +#: libs/localization.py:52 msgid "Your surname is a bit short, don't you think?" msgstr "Your surname is a bit short, don't you think?" -#: libs/localization.py:51 +#: libs/localization.py:53 msgid "Your first and last name have been successfully updated." msgstr "Your first and last name have been successfully updated." -#: libs/localization.py:52 +#: libs/localization.py:54 msgid "Invalid email address. Please try again." msgstr "Invalid email address. Please try again." -#: libs/localization.py:53 +#: libs/localization.py:55 msgid "Email address has not been changed." msgstr "Email address has not been changed." -#: libs/localization.py:54 +#: libs/localization.py:56 msgid "Your email has been successfully updated." msgstr "Your email has been successfully updated." -#: libs/localization.py:55 +#: libs/localization.py:57 msgid "The password entered is the same as the current password." msgstr "The password entered is the same as the current password." -#: libs/localization.py:56 +#: libs/localization.py:58 msgid "Password has been changed!" msgstr "Password has been changed!" -#: libs/localization.py:57 +#: libs/localization.py:59 msgid "Please, type your username for account deletion." msgstr "Please, type your username for account deletion." -#: libs/localization.py:58 +#: libs/localization.py:60 msgid "Account successfully deleted!" msgstr "Account successfully deleted!" -#: libs/localization.py:59 +#: libs/localization.py:61 msgid "Username or password is incorrect!" msgstr "Username or password is incorrect!" -#: libs/localization.py:60 +#: libs/localization.py:62 msgid "Unable to connect to the remote server." msgstr "Unable to connect to the remote server." -#: libs/localization.py:61 +#: libs/localization.py:63 msgid "" "Encountered an unexpected error while communicating with the remote server." msgstr "" "Encountered an unexpected error while communicating with the remote server." -#: libs/localization.py:62 +#: libs/localization.py:64 msgid "User already exists." msgstr "User already exists." -#: libs/localization.py:63 +#: libs/localization.py:65 msgid "Email already exists." msgstr "Email already exists." -#: libs/localization.py:64 +#: libs/localization.py:66 msgid "Forgot your password? Please try again." msgstr "Forgot your password? Please try again." -#: libs/localization.py:65 +#: libs/localization.py:67 msgid "The session has expired." msgstr "The session has expired." + +#: libs/localization.py:68 +msgid "Registration is currently closed. We apologize for the inconvenience." +msgstr "Registration is currently closed. We apologize for the inconvenience." \ No newline at end of file diff --git a/locales/eu/LC_MESSAGES/base.mo b/locales/eu/LC_MESSAGES/base.mo index 0b01bd5..fee4351 100644 Binary files a/locales/eu/LC_MESSAGES/base.mo and b/locales/eu/LC_MESSAGES/base.mo differ diff --git a/locales/eu/LC_MESSAGES/base.po b/locales/eu/LC_MESSAGES/base.po index d47ebc5..3aa33ca 100644 --- a/locales/eu/LC_MESSAGES/base.po +++ b/locales/eu/LC_MESSAGES/base.po @@ -113,35 +113,35 @@ msgstr "Kontua ezabatu" msgid "Welcome" msgstr "Ongi etorri" -#: libs/localization.py:38 +#: libs/localization.py:40 msgid "The session was closed." msgstr "Saioa itxi da." -#: libs/localization.py:40 +#: libs/localization.py:42 msgid "Username must be at least 3 characters long!" msgstr "Erabiltzaile izenak gutxienez 3 karaktere izan behar ditu!" -#: libs/localization.py:41 +#: libs/localization.py:43 msgid "Not allowed characters for the username field." msgstr "Erabiltzaile-izenaren eremurako onartzen ez diren karaktereak." -#: libs/localization.py:42 +#: libs/localization.py:44 msgid "Not allowed characters for the firstname field." msgstr "Izenaren eremurako onartzen ez diren karaktereak." -#: libs/localization.py:43 +#: libs/localization.py:45 msgid "Not allowed characters for the surname field." msgstr "Abizenaren eremurako onartzen ez diren karaktereak." -#: libs/localization.py:44 +#: libs/localization.py:46 msgid "The code is invalid or has expired." msgstr "Kodea baliogabea da edo iraungi egin da." -#: libs/localization.py:45 +#: libs/localization.py:47 msgid "Passwords do not match!" msgstr "Pasahitzak ez datoz bat!" -#: libs/localization.py:46 +#: libs/localization.py:48 msgid "" "The password must contain at least 8 characters, at least one number, " "a capital letter and a special character." @@ -149,79 +149,83 @@ msgstr "" "Pasahitzak gutxienez 8 karaktere izan behar ditu, zenbaki bat, hizki larri bat " "eta karaktere berezi bat." -#: libs/localization.py:47 +#: libs/localization.py:49 msgid "Congratulations, your account has been created!" msgstr "Zorionak, zure kontua sortu da!" -#: libs/localization.py:48 +#: libs/localization.py:50 msgid "Your first and last name have not been changed." msgstr "Zure izen-abizenak ez dira aldatu." -#: libs/localization.py:49 +#: libs/localization.py:51 msgid "Your firstname is a bit short, don't you think?" msgstr "Zure izena labur-xamarra da, ez duzu uste?" -#: libs/localization.py:50 +#: libs/localization.py:52 msgid "Your surname is a bit short, don't you think?" msgstr "Zure abizena labur-xamarra da, ez duzu uste?" -#: libs/localization.py:51 +#: libs/localization.py:53 msgid "Your first and last name have been successfully updated." msgstr "Zure izen-abizenak ongi eguneratu dira." -#: libs/localization.py:52 +#: libs/localization.py:54 msgid "Invalid email address. Please try again." msgstr "Baliogabeko email helbidea. Saia zaitez berriz, mesedez." -#: libs/localization.py:53 +#: libs/localization.py:55 msgid "Email address has not been changed." msgstr "Email helbidea ez da aldatu." -#: libs/localization.py:54 +#: libs/localization.py:56 msgid "Your email has been successfully updated." msgstr "Zure emaila ongi eguneratu da." -#: libs/localization.py:55 +#: libs/localization.py:57 msgid "The password entered is the same as the current password." msgstr "Sartutako pasahitza egungo pasahitzaren berdina da." -#: libs/localization.py:56 +#: libs/localization.py:58 msgid "Password has been changed!" msgstr "Pasahitza eguneratua izan da!" -#: libs/localization.py:57 +#: libs/localization.py:59 msgid "Please, type your username for account deletion." msgstr "Kontua ezabatzeko idatzi zure erabiltzaile izena, mesedez." -#: libs/localization.py:58 +#: libs/localization.py:60 msgid "Account successfully deleted!" msgstr "Kontua ongi ezabatu da!" -#: libs/localization.py:59 +#: libs/localization.py:61 msgid "Username or password is incorrect!" msgstr "Erabiltzaile izena edo pasahitza okerrak dira!" -#: libs/localization.py:60 +#: libs/localization.py:62 msgid "Unable to connect to the remote server." msgstr "Ezinezkoa urruneko zerbitzara konektatzea." -#: libs/localization.py:61 +#: libs/localization.py:63 msgid "" "Encountered an unexpected error while communicating with the remote server." msgstr "Ezusteko errore bat gertatu da urruneko zerbitzariarekin komunikatzean." -#: libs/localization.py:62 +#: libs/localization.py:64 msgid "User already exists." msgstr "Erabiltzaile hori existitzen da." -#: libs/localization.py:63 +#: libs/localization.py:65 msgid "Email already exists." msgstr "Email hori existitzen da." -#: libs/localization.py:64 +#: libs/localization.py:66 msgid "Forgot your password? Please try again." msgstr "Zure pasahitza ahaztu duzu? Saia zeitez berriz, mesedez." -#: libs/localization.py:65 +#: libs/localization.py:67 msgid "The session has expired." msgstr "Saioa iraungi egin da." + +#: libs/localization.py:68 +msgid "Registration is currently closed. We apologize for the inconvenience." +msgstr "Izen-ematea itxita dago une honetan. Barkatu eragozpenak." \ No newline at end of file diff --git a/settings.ini.example b/settings.ini.example index 23ff3c7..7fd0c8d 100644 --- a/settings.ini.example +++ b/settings.ini.example @@ -1,6 +1,9 @@ #[html] #page_title = Login +[general] +allow_registration = True + [ldap:0] host = localhost port = 636