From d361594e85aed027b2fde05897f6b117bc95bc36 Mon Sep 17 00:00:00 2001 From: aitzol76 Date: Sun, 11 Sep 2022 19:28:52 +0200 Subject: [PATCH] registration --- app.py | 11 ++++++- libs/localization.py | 4 ++- locales/base.pot | 58 ++++++++++++++++++--------------- locales/en/LC_MESSAGES/base.mo | Bin 4301 -> 4457 bytes locales/en/LC_MESSAGES/base.po | 58 ++++++++++++++++++--------------- locales/eu/LC_MESSAGES/base.mo | Bin 4385 -> 4529 bytes locales/eu/LC_MESSAGES/base.po | 58 ++++++++++++++++++--------------- settings.ini.example | 3 ++ 8 files changed, 109 insertions(+), 83 deletions(-) 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 971d482c204146d34b371d366a615001b0816c9e..a26a2ba59a042f73c7e5937320068b4960fc0d7f 100644 GIT binary patch delta 1211 zcmb``%S%*Y7{~D^XVe*Uw9%xC8b`Z~=8Tu@=Asa$GL%4q5ZZ){Cp$LGiJ2)V2-|g8 zv>AdntzFb2k)qmkp-p9*7A_*9g&=JNYturb?@!PC2OZAye%^Ct=6&Did6>^_Kij9j zH-sM;*CC>Xc)!VP2(uvut~+6~R=kVcHp8$LpWqgJi#_-StFWTdtP!JFkFD5%Dde_6 zhTV7yo6M$dipdBsZebMXF@X!%fq!u`CRm-R^`kZ#V5r4G)B(<53U6XJJ`O(riZwhh z1^&Va&uh4o{jI9nY#T4yuonmLBu*i>Jq>(;I{6zMz(w?N7prZ@`>1thFoCa;J!}an zjxD1q_Zzt_Lbgfvw>Xn_JdUhso$W!}-8fRHjMN(!%GlpSE2t9^nMn# z;d4~0KB3n6hB{a+<(pQo8ky8%0@bS{s8SE3G9E>GWknppd&n7V0hQ?w?7&EDqg8#V z-ycJ5lt#W{!>9v{VG3`@sK0vkEcn7As#hz4tEf^{*Qr-zfhutqs#R%JtBR<~y$XDX zI`~IatCrEn4zg6M9-`Knt*8FV-~%so(iK$c{-8>?hB`n4^-E$is#T{^8(zjvETCHT z2zziLuqwWh>0#8m6G*4luRg}TqYPaHEm_~t!4RQE+X$6)2f=#lCEt(b>p*#e%C?_K zlwO9?as8PO61{{P*IkN*n^P%fN}_z}pnJ*>xR0nH)VlV$bK%O+iL>scS19Jki=Llz zyn>Utn$NqrV)nX|$@&F%qT3mBo$)Jv)}QolxXwjC?-Vb&j+e{$xod9Db8{JYuBC3a NVlG$+`u^M07-Ol6l1vT{r(9Hc|Y;|hWWf_u!{Zd z7eOTxC3!4{QRK0H&mq)_NALm8;20j@E$m`7eg7C6aTr~O6P%2j|WQIa%i{wZq1=cp3BM6L4%b+EUn z676FuMDT?`HTsH5@g?fUzmXbQHF@sE1hTiiM%{D@n{W&HtDU00|Bl)ygFJT0pab}V z*B59!Ir0V`fuv;Y7A 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 0b01bd5cbed0b27ad1cb1b5f45c4083ec6196abc..fee4351e55d5b915e2b8a192c4961b0a2eec6ab5 100644 GIT binary patch delta 1194 zcmXxj%S%*I9Ki9PU8fkUZbqAWp3IG z{Q*HBp^Hj_T2&-L;HpJrL94)BM6H6dzQ3F~+;cwX+!@aAcOLga!;>A;Un;}*g|d&j zjk=g4GJuI(8p_?UNG;AFkId3+z%)| zh4_+RAX3ANdThgPJc?t;BabsaN6q{dcH>v{v5wg`;XTxOW-)>s?G-MOF0 zBZaKCh4@lIrvZDAImN*ybg>K5s4HB`_#1VlEi6kXzJMJZ+eOp_(rlLooIBp z7PsRvYMfsBMoJJFAu(ZK<{iFy=oP!oKYF;ud4Ck~=+`KgRU zsCVHKwqpuA@L>u2-$UmkFZ43ikc}qPNTcKZ$YSL<>LnaR-RdMBz!}t|SVVG=Rn(Og z6Ri=ePy-#pQB0yPbQ$@pd@p1Fo9X=Jg$8OSD!E7}8tluA&J&-2Op3;!Xr9 zCvbhwxDzHmnMzqNNZc^-gg;@2V`j)2C+R2r5qHX(%YMoPqt>`y-1n|o&$V9ME}So@ zF6cTjWxc4q;sn+)ZgAZV95d{U_-4|xX4Lm=;CM09=cLA+VA9wWKTRdA=Zr5TN}q-P E0Yct|+W-In delta 1052 zcmX}rPe_zO7{~EP_q9#eRo6e6x|_DEuA8oIZioddK?eyT=n#T<5FseRKM;uGVL|VK zh!k0Z6khU>?#;Z|A=H}+b&Cw54(Y*z5QzBw<+}~<%xB(r_kCvOnR!or)v?^Krxy^OrR!^!Z;3ND=xUd?_dGo^xvbB15H;f=yp7Ls6u0myb`nkRKg1|LMMByvk_3B+%Gev^vNf6( z{D@)3x8HP#Wj>Z4!!qo|6l!JTuFI$uenACxSXPql%12EgMVd75Bh(i3qf$SHwK#(s z=PefDdrV)UvrdP-uw7JuU#PQigjMJx&)wL7+Ja%!1fRLCpw7ZiRH{#0bNm-)pb&5J zJcvnrfL%E4C;xhJlLwm79_s!8S)?7K4&Ny%)z$pz4knQ?Yy`EUDQvFIxpr8AMZOQSDMv#+Bns8Y`R|7IA&Y*7lcMT53e8|St?_X7HOweB{m rHZndJa%$q5NHaBCv=ANSY-ymAOVyTM&pdYWJed#Pa&P9WD3f~*!$?>` 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