diff options
-rwxr-xr-x | inc/poche/Poche.class.php | 18 | ||||
-rwxr-xr-x | inc/poche/Routing.class.php | 10 | ||||
-rwxr-xr-x | inc/poche/Tools.class.php | 2 | ||||
-rwxr-xr-x | inc/poche/config.inc.default.php | 3 | ||||
-rw-r--r-- | locale/en_US.utf8/LC_MESSAGES/en_US.utf8.mo | bin | 17302 -> 17544 bytes | |||
-rw-r--r-- | locale/en_US.utf8/LC_MESSAGES/en_US.utf8.po | 18 | ||||
-rw-r--r-- | locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo | bin | 22690 -> 22961 bytes | |||
-rw-r--r-- | locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po | 17 | ||||
-rw-r--r-- | themes/baggy/login.twig | 5 | ||||
-rw-r--r-- | themes/baggy/register.twig | 28 | ||||
-rw-r--r-- | themes/default/login.twig | 5 | ||||
-rw-r--r-- | themes/default/register.twig | 20 |
12 files changed, 113 insertions, 13 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 8ade91b4..6d4ce137 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -76,6 +76,7 @@ class Poche | |||
76 | */ | 76 | */ |
77 | public function createNewUser($username, $password, $email = "", $internalRegistration = false) | 77 | public function createNewUser($username, $password, $email = "", $internalRegistration = false) |
78 | { | 78 | { |
79 | Tools::logm('Trying to create a new user...'); | ||
79 | if (!empty($username) && !empty($password)){ | 80 | if (!empty($username) && !empty($password)){ |
80 | $newUsername = filter_var($username, FILTER_SANITIZE_STRING); | 81 | $newUsername = filter_var($username, FILTER_SANITIZE_STRING); |
81 | $email = filter_var($email, FILTER_SANITIZE_STRING); | 82 | $email = filter_var($email, FILTER_SANITIZE_STRING); |
@@ -84,7 +85,7 @@ class Poche | |||
84 | if ($email != "") { // if email is filled | 85 | if ($email != "") { // if email is filled |
85 | if (SEND_CONFIRMATION_EMAIL && function_exists('mail')) { | 86 | if (SEND_CONFIRMATION_EMAIL && function_exists('mail')) { |
86 | 87 | ||
87 | // if internal registration | 88 | // if internal registration from config screen |
88 | $body_internal = _('Hi,') . "\r\n\r\n" . sprintf(_('Someone just created a wallabag account for you on %1$s.'), Tools::getPocheUrl()) . | 89 | $body_internal = _('Hi,') . "\r\n\r\n" . sprintf(_('Someone just created a wallabag account for you on %1$s.'), Tools::getPocheUrl()) . |
89 | "\r\n\r\n" . sprintf(_('Your login is %1$s.'), $newUsername) ."\r\n\r\n" . | 90 | "\r\n\r\n" . sprintf(_('Your login is %1$s.'), $newUsername) ."\r\n\r\n" . |
90 | _('Note : The password has been chosen by the person who created your account. Get in touch with that person to know your password and change it as soon as possible') . "\r\n\r\n" . | 91 | _('Note : The password has been chosen by the person who created your account. Get in touch with that person to know your password and change it as soon as possible') . "\r\n\r\n" . |
@@ -92,7 +93,10 @@ class Poche | |||
92 | _('This is an automatically generated message, no one will answer if you respond to it.'); | 93 | _('This is an automatically generated message, no one will answer if you respond to it.'); |
93 | 94 | ||
94 | // if external (public) registration | 95 | // if external (public) registration |
95 | $body = "Hi, " . $newUsername . "\r\n\r\nYou've just created a wallabag account on " . Tools::getPocheUrl() . ".\r\nHave fun with it !"; | 96 | $body = sprintf(_('Hi, %1$s'), $newUsername) . "\r\n\r\n" . |
97 | sprintf(_('You\'ve just created a wallabag account on %1$s.'), Tools::getPocheUrl()) . | ||
98 | "\r\n\r\n" . _("Have fun with it !"); | ||
99 | |||
96 | $body = $internalRegistration ? $body_internal : $body; | 100 | $body = $internalRegistration ? $body_internal : $body; |
97 | 101 | ||
98 | $body = wordwrap($body, 70, "\r\n"); // cut lines with more than 70 caracters (MIME standard) | 102 | $body = wordwrap($body, 70, "\r\n"); // cut lines with more than 70 caracters (MIME standard) |
@@ -102,6 +106,7 @@ class Poche | |||
102 | "From: " . $newUsername . "@" . gethostname() . "\r\n")) { | 106 | "From: " . $newUsername . "@" . gethostname() . "\r\n")) { |
103 | Tools::logm('The user ' . $newUsername . ' has been emailed'); | 107 | Tools::logm('The user ' . $newUsername . ' has been emailed'); |
104 | $this->messages->add('i', sprintf(_('The new user %1$s has been sent an email at %2$s. You may have to check spam folder.'), $newUsername, $email)); | 108 | $this->messages->add('i', sprintf(_('The new user %1$s has been sent an email at %2$s. You may have to check spam folder.'), $newUsername, $email)); |
109 | Tools::redirect('?'); | ||
105 | 110 | ||
106 | } else { | 111 | } else { |
107 | Tools::logm('A problem has been encountered while sending an email'); | 112 | Tools::logm('A problem has been encountered while sending an email'); |
@@ -109,14 +114,16 @@ class Poche | |||
109 | } | 114 | } |
110 | } else { | 115 | } else { |
111 | Tools::logm('The user has been created, but the server did not authorize sending emails'); | 116 | Tools::logm('The user has been created, but the server did not authorize sending emails'); |
112 | $this->messages->add('i', _('The server did not authorize sending a confirmation email')); | 117 | $this->messages->add('i', _('The server did not authorize sending a confirmation email, but the user was created.')); |
113 | } | 118 | } |
114 | } else { | 119 | } else { |
115 | Tools::logm('The user has been created, but no email was saved, so no confimation email was sent'); | 120 | Tools::logm('The user has been created, but no email was saved, so no confimation email was sent'); |
116 | $this->messages->add('i', _('The user was created, but no email was sent because email was not filled in')); | 121 | $this->messages->add('i', _('The user was created, but no email was sent because email was not filled in')); |
117 | } | 122 | } |
118 | Tools::logm('The new user ' . $newUsername . ' has been installed'); | 123 | Tools::logm('The new user ' . $newUsername . ' has been installed'); |
119 | $this->messages->add('s', sprintf(_('The new user %s has been installed. Do you want to <a href="?logout">logout ?</a>'), $newUsername)); | 124 | if (\Session::isLogged()) { |
125 | $this->messages->add('s', sprintf(_('The new user %s has been installed. Do you want to <a href="?logout">logout ?</a>'), $newUsername)); | ||
126 | } | ||
120 | Tools::redirect(); | 127 | Tools::redirect(); |
121 | } | 128 | } |
122 | else { | 129 | else { |
@@ -130,6 +137,9 @@ class Poche | |||
130 | Tools::redirect(); | 137 | Tools::redirect(); |
131 | } | 138 | } |
132 | } | 139 | } |
140 | else { | ||
141 | Tools::logm('Password or username were empty'); | ||
142 | } | ||
133 | } | 143 | } |
134 | 144 | ||
135 | /** | 145 | /** |
diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php index 82ff20d6..177b74d5 100755 --- a/inc/poche/Routing.class.php +++ b/inc/poche/Routing.class.php | |||
@@ -68,6 +68,12 @@ class Routing | |||
68 | $this->wallabag->action($this->action, $this->url, $this->id, FALSE, $this->autoclose); | 68 | $this->wallabag->action($this->action, $this->url, $this->id, FALSE, $this->autoclose); |
69 | $tplFile = Tools::getTplFile($this->view); | 69 | $tplFile = Tools::getTplFile($this->view); |
70 | $tplVars = array_merge($this->vars, $this->wallabag->displayView($this->view, $this->id)); | 70 | $tplVars = array_merge($this->vars, $this->wallabag->displayView($this->view, $this->id)); |
71 | } elseif(ALLOW_REGISTER && isset($_GET['registerform'])) { | ||
72 | Tools::logm('register'); | ||
73 | $tplFile = Tools::getTplFile('register'); | ||
74 | } elseif (ALLOW_REGISTER && isset($_GET['register'])){ | ||
75 | $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser'], $_POST['newuseremail']); | ||
76 | Tools::redirect(); | ||
71 | } elseif(isset($_SERVER['PHP_AUTH_USER'])) { | 77 | } elseif(isset($_SERVER['PHP_AUTH_USER'])) { |
72 | if($this->wallabag->store->userExists($_SERVER['PHP_AUTH_USER'])) { | 78 | if($this->wallabag->store->userExists($_SERVER['PHP_AUTH_USER'])) { |
73 | $this->wallabag->login($this->referer); | 79 | $this->wallabag->login($this->referer); |
@@ -105,7 +111,9 @@ class Routing | |||
105 | $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0); | 111 | $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0); |
106 | $limit = (isset($_GET['limit']) ? intval($_GET['limit']) : 0); | 112 | $limit = (isset($_GET['limit']) ? intval($_GET['limit']) : 0); |
107 | $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type'], $limit); | 113 | $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type'], $limit); |
108 | } | 114 | } //elseif (ALLOW_REGISTER && isset($_GET['register'])) { |
115 | //$this->wallabag->register | ||
116 | //} | ||
109 | 117 | ||
110 | //allowed ONLY to logged in user | 118 | //allowed ONLY to logged in user |
111 | if (\Session::isLogged() === true) | 119 | if (\Session::isLogged() === true) |
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 7ccfc069..d0b31d4f 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php | |||
@@ -117,7 +117,7 @@ final class Tools | |||
117 | { | 117 | { |
118 | $views = array( | 118 | $views = array( |
119 | 'install', 'import', 'export', 'config', 'tags', | 119 | 'install', 'import', 'export', 'config', 'tags', |
120 | 'edit-tags', 'view', 'login', 'error', 'about' | 120 | 'edit-tags', 'view', 'login', 'error', 'about', 'register' |
121 | ); | 121 | ); |
122 | 122 | ||
123 | return (in_array($view, $views) ? $view . '.twig' : 'home.twig'); | 123 | return (in_array($view, $views) ? $view . '.twig' : 'home.twig'); |
diff --git a/inc/poche/config.inc.default.php b/inc/poche/config.inc.default.php index fbf4ae9a..6750383e 100755 --- a/inc/poche/config.inc.default.php +++ b/inc/poche/config.inc.default.php | |||
@@ -60,7 +60,8 @@ | |||
60 | @define ('PDF', FALSE); | 60 | @define ('PDF', FALSE); |
61 | 61 | ||
62 | // registration | 62 | // registration |
63 | @define ('SEND_CONFIRMATION_EMAIL', TRUE); | 63 | @define ('SEND_CONFIRMATION_EMAIL', FALSE); |
64 | @define ('ALLOW_REGISTER', TRUE); | ||
64 | 65 | ||
65 | // display or not print link in article view | 66 | // display or not print link in article view |
66 | @define ('SHOW_PRINTLINK', '1'); | 67 | @define ('SHOW_PRINTLINK', '1'); |
diff --git a/locale/en_US.utf8/LC_MESSAGES/en_US.utf8.mo b/locale/en_US.utf8/LC_MESSAGES/en_US.utf8.mo index 02523125..f2c8a0f6 100644 --- a/locale/en_US.utf8/LC_MESSAGES/en_US.utf8.mo +++ b/locale/en_US.utf8/LC_MESSAGES/en_US.utf8.mo | |||
Binary files differ | |||
diff --git a/locale/en_US.utf8/LC_MESSAGES/en_US.utf8.po b/locale/en_US.utf8/LC_MESSAGES/en_US.utf8.po index 75dad661..73589e20 100644 --- a/locale/en_US.utf8/LC_MESSAGES/en_US.utf8.po +++ b/locale/en_US.utf8/LC_MESSAGES/en_US.utf8.po | |||
@@ -369,8 +369,8 @@ msgstr "Mark all the entries as read" | |||
369 | msgid "Return home" | 369 | msgid "Return home" |
370 | msgstr "Return home" | 370 | msgstr "Return home" |
371 | 371 | ||
372 | msgid "Back to top" | 372 | msgid "back" |
373 | msgstr "Back to top" | 373 | msgstr "back" |
374 | 374 | ||
375 | msgid "Mark as read" | 375 | msgid "Mark as read" |
376 | msgstr "Mark as read" | 376 | msgstr "Mark as read" |
@@ -435,6 +435,9 @@ msgstr "Save a Link" | |||
435 | msgid "back to home" | 435 | msgid "back to home" |
436 | msgstr "Back to Home" | 436 | msgstr "Back to Home" |
437 | 437 | ||
438 | msgid "back to login" | ||
439 | msgstr "back to login" | ||
440 | |||
438 | msgid "toggle mark as read" | 441 | msgid "toggle mark as read" |
439 | msgstr "Toggle mark as read" | 442 | msgstr "Toggle mark as read" |
440 | 443 | ||
@@ -673,6 +676,9 @@ msgstr "Hi, %1$s" | |||
673 | msgid "Someone just created a wallabag account for you on %1$s." | 676 | msgid "Someone just created a wallabag account for you on %1$s." |
674 | msgstr "Someone just created a wallabag account for you on %1$s." | 677 | msgstr "Someone just created a wallabag account for you on %1$s." |
675 | 678 | ||
679 | msgid "You've just created a wallabag account on %1$s" | ||
680 | msgstr "You've just created a wallabag account on %1$s" | ||
681 | |||
676 | msgid "Your login is %1$s." | 682 | msgid "Your login is %1$s." |
677 | msgstr "Your login is %1$s." | 683 | msgstr "Your login is %1$s." |
678 | 684 | ||
@@ -702,8 +708,12 @@ msgstr "" | |||
702 | "The new user %1$s has been sent an email at %2$s. You may have to check spam " | 708 | "The new user %1$s has been sent an email at %2$s. You may have to check spam " |
703 | "folder." | 709 | "folder." |
704 | 710 | ||
705 | msgid "A problem has been encountered while sending the confirmation email" | 711 | msgid "" |
706 | msgstr "A problem has been encountered while sending an confirmation email" | 712 | "A problem has been encountered while sending the confirmation email, but the " |
713 | "user was created." | ||
714 | msgstr "" | ||
715 | "A problem has been encountered while sending an confirmation email, but the " | ||
716 | "user was created." | ||
707 | 717 | ||
708 | msgid "The server did not authorize sending a confirmation email" | 718 | msgid "The server did not authorize sending a confirmation email" |
709 | msgstr "The server did not authorize sending a confirmation email" | 719 | msgstr "The server did not authorize sending a confirmation email" |
diff --git a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo index b3b2f6fe..1f1995b8 100644 --- a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo +++ b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo | |||
Binary files differ | |||
diff --git a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po index 948a8356..526a44a3 100644 --- a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po +++ b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po | |||
@@ -67,6 +67,9 @@ msgstr "Se connecter" | |||
67 | msgid "back to home" | 67 | msgid "back to home" |
68 | msgstr "retour à l'accueil" | 68 | msgstr "retour à l'accueil" |
69 | 69 | ||
70 | msgid "back" | ||
71 | msgstr "retour" | ||
72 | |||
70 | msgid "favorites" | 73 | msgid "favorites" |
71 | msgstr "favoris" | 74 | msgstr "favoris" |
72 | 75 | ||
@@ -357,6 +360,9 @@ msgstr "Tweet" | |||
357 | msgid "Email" | 360 | msgid "Email" |
358 | msgstr "E-mail" | 361 | msgstr "E-mail" |
359 | 362 | ||
363 | msgid "Email (not required)" | ||
364 | msgstr "E-mail (non requis)" | ||
365 | |||
360 | msgid "shaarli" | 366 | msgid "shaarli" |
361 | msgstr "Shaarli" | 367 | msgstr "Shaarli" |
362 | 368 | ||
@@ -800,6 +806,9 @@ msgid "Someone just created a wallabag account for you on %1$s." | |||
800 | msgstr "" | 806 | msgstr "" |
801 | "Quelqu'un vient juste de créer un compte wallabag pour vous à l'adresse %1$s." | 807 | "Quelqu'un vient juste de créer un compte wallabag pour vous à l'adresse %1$s." |
802 | 808 | ||
809 | msgid "You've just created a wallabag account on %1$s" | ||
810 | msgstr "Vous venez juste de vous créer un compte wallabag sur %1$s" | ||
811 | |||
803 | msgid "Your login is %1$s." | 812 | msgid "Your login is %1$s." |
804 | msgstr "Votre identifiant is %1$s." | 813 | msgstr "Votre identifiant is %1$s." |
805 | 814 | ||
@@ -832,8 +841,12 @@ msgstr "" | |||
832 | msgid "A problem has been encountered while sending the confirmation email" | 841 | msgid "A problem has been encountered while sending the confirmation email" |
833 | msgstr "Un problème a été rencontré lors de l'envoi de l'email de confirmation" | 842 | msgstr "Un problème a été rencontré lors de l'envoi de l'email de confirmation" |
834 | 843 | ||
835 | msgid "The server did not authorize sending a confirmation email" | 844 | msgid "" |
836 | msgstr "Le serveur n'autorise pas l'envoi d'un email de confirmation" | 845 | "The server did not authorize sending a confirmation email, but the user was " |
846 | "created." | ||
847 | msgstr "" | ||
848 | "Le serveur n'autorise pas l'envoi d'un email de confirmation, mais " | ||
849 | "l'utilisateur a été créé." | ||
837 | 850 | ||
838 | msgid "" | 851 | msgid "" |
839 | "The user was created, but no email was sent because email was not filled in" | 852 | "The user was created, but no email was sent because email was not filled in" |
diff --git a/themes/baggy/login.twig b/themes/baggy/login.twig index 58290e9c..d941ca93 100644 --- a/themes/baggy/login.twig +++ b/themes/baggy/login.twig | |||
@@ -26,6 +26,11 @@ | |||
26 | <div class="row mts txtcenter"> | 26 | <div class="row mts txtcenter"> |
27 | <button class="bouton" type="submit" tabindex="4">{% trans "Sign in" %}</button> | 27 | <button class="bouton" type="submit" tabindex="4">{% trans "Sign in" %}</button> |
28 | </div> | 28 | </div> |
29 | {% if constant('ALLOW_REGISTER') == 1 %} | ||
30 | <div class="register"> | ||
31 | <a href="?registerform">{% trans "Register" %}</a> | ||
32 | </div> | ||
33 | {% endif %} | ||
29 | </fieldset> | 34 | </fieldset> |
30 | <input type="hidden" name="returnurl" value="{{ referer }}"> | 35 | <input type="hidden" name="returnurl" value="{{ referer }}"> |
31 | <input type="hidden" name="token" value="{{ token }}"> | 36 | <input type="hidden" name="token" value="{{ token }}"> |
diff --git a/themes/baggy/register.twig b/themes/baggy/register.twig new file mode 100644 index 00000000..e2c56c73 --- /dev/null +++ b/themes/baggy/register.twig | |||
@@ -0,0 +1,28 @@ | |||
1 | {% extends "layout-login.twig" %} | ||
2 | {% block content %} | ||
3 | |||
4 | <form method="post" action="?register"> | ||
5 | <h2>{% trans 'Add user' %}</h2> | ||
6 | <fieldset class="w500p"> | ||
7 | <div class="row"> | ||
8 | <label class="col w150p" for="newusername">{% trans 'Login' %}</label> | ||
9 | <input class="col" type="text" id="newusername" name="newusername" placeholder="{% trans 'Login' %}" required> | ||
10 | </div> | ||
11 | <div class="row"> | ||
12 | <label class="col w150p" for="password4newuser">{% trans "Password" %}</label> | ||
13 | <input class="col" type="password" id="password4newuser" name="password4newuser" placeholder="{% trans 'Password' %}" required> | ||
14 | </div> | ||
15 | <div class="row"> | ||
16 | <label class="col w150p" for="newuseremail">{% trans 'Email (not required)' %}</label> | ||
17 | <input class="col" type="email" id="newuseremail" name="newuseremail" placeholder="{% trans 'Email' %}"> | ||
18 | </div> | ||
19 | <div class="row mts txtcenter"> | ||
20 | <button type="submit">{% trans "Register" %}</button> | ||
21 | </div> | ||
22 | <div class="register"> | ||
23 | <a href="?">{% trans "Back" %}</a> | ||
24 | </div> | ||
25 | </fieldset> | ||
26 | </form> | ||
27 | |||
28 | {% endblock %} \ No newline at end of file | ||
diff --git a/themes/default/login.twig b/themes/default/login.twig index b9f8b497..d4f44019 100644 --- a/themes/default/login.twig +++ b/themes/default/login.twig | |||
@@ -31,4 +31,9 @@ | |||
31 | <input type="hidden" name="token" value="{{ token }}"> | 31 | <input type="hidden" name="token" value="{{ token }}"> |
32 | </form> | 32 | </form> |
33 | {% endif %} | 33 | {% endif %} |
34 | {% if constant('ALLOW_REGISTER') == 1 %} | ||
35 | <div class="registerform"> | ||
36 | <a href="?register">{% trans "Register" %}</a> | ||
37 | </div> | ||
38 | {% endif %} | ||
34 | {% endblock %} | 39 | {% endblock %} |
diff --git a/themes/default/register.twig b/themes/default/register.twig new file mode 100644 index 00000000..755ae132 --- /dev/null +++ b/themes/default/register.twig | |||
@@ -0,0 +1,20 @@ | |||
1 | <h2>{% trans 'Add user' %}</h2> | ||
2 | <form method="post" action="?newuser"> | ||
3 | <fieldset class="w500p"> | ||
4 | <div class="row"> | ||
5 | <label class="col w150p" for="newusername">{% trans 'Login' %}</label> | ||
6 | <input class="col" type="text" id="newusername" name="newusername" placeholder="{% trans 'Login' %}" required> | ||
7 | </div> | ||
8 | <div class="row"> | ||
9 | <label class="col w150p" for="password4newuser">{% trans "Password" %}</label> | ||
10 | <input class="col" type="password" id="password4newuser" name="password4newuser" placeholder="{% trans 'Password' %}" required> | ||
11 | </div> | ||
12 | <div class="row"> | ||
13 | <label class="col w150p" for="newuseremail">{% trans 'Email' %}</label> | ||
14 | <input class="col" type="email" id="newuseremail" name="newuseremail" placeholder="{% trans 'Email' %}"> | ||
15 | </div> | ||
16 | <div class="row mts txtcenter"> | ||
17 | <button type="submit">{% trans "Register" %}</button> | ||
18 | </div> | ||
19 | </fieldset> | ||
20 | </form> \ No newline at end of file | ||