From 121691e90026dcfaaecef0a1db07d40cd43a9278 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 23 Jan 2015 16:34:56 +0100 Subject: working on registration support --- inc/poche/Poche.class.php | 4 ++++ inc/poche/Routing.class.php | 10 +++++++++- inc/poche/Tools.class.php | 2 +- inc/poche/config.inc.default.php | 4 +++- themes/baggy/login.twig | 5 +++++ themes/baggy/register.twig | 25 +++++++++++++++++++++++++ themes/default/login.twig | 5 +++++ themes/default/register.twig | 20 ++++++++++++++++++++ 8 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 themes/baggy/register.twig create mode 100644 themes/default/register.twig diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 81a18c86..36c8693c 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -76,6 +76,7 @@ class Poche */ public function createNewUser($username, $password, $email = "") { + Tools::logm('Trying to create a new user...'); if (!empty($username) && !empty($password)){ $newUsername = filter_var($username, FILTER_SANITIZE_STRING); $email = filter_var($email, FILTER_SANITIZE_STRING); @@ -96,6 +97,9 @@ class Poche Tools::redirect(); } } + else { + Tools::logm('Password or username were empty'); + } } /** diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php index be06a433..8d6abefd 100755 --- a/inc/poche/Routing.class.php +++ b/inc/poche/Routing.class.php @@ -67,6 +67,12 @@ class Routing $this->wallabag->action($this->action, $this->url, $this->id); $tplFile = Tools::getTplFile($this->view); $tplVars = array_merge($this->vars, $this->wallabag->displayView($this->view, $this->id)); + } elseif(ALLOW_REGISTER && isset($_GET['registerform'])) { + Tools::logm('register'); + $tplFile = Tools::getTplFile('register'); + } elseif (ALLOW_REGISTER && isset($_GET['register'])){ + $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser']); + Tools::redirect(); } elseif(isset($_SERVER['PHP_AUTH_USER'])) { if($this->wallabag->store->userExists($_SERVER['PHP_AUTH_USER'])) { $this->wallabag->login($this->referer); @@ -104,7 +110,9 @@ class Routing $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0); $limit = (isset($_GET['limit']) ? intval($_GET['limit']) : 0); $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type'], $limit); - } + } //elseif (ALLOW_REGISTER && isset($_GET['register'])) { + //$this->wallabag->register + //} //allowed ONLY to logged in user 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 { $views = array( 'install', 'import', 'export', 'config', 'tags', - 'edit-tags', 'view', 'login', 'error', 'about' + 'edit-tags', 'view', 'login', 'error', 'about', 'register' ); 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 a159e713..3156b56c 100755 --- a/inc/poche/config.inc.default.php +++ b/inc/poche/config.inc.default.php @@ -31,7 +31,9 @@ @define ('SSL_PORT', 443); @define ('MODE_DEMO', FALSE); -@define ('DEBUG_POCHE', FALSE); +@define ('DEBUG_POCHE', TRUE); + +@define ('ALLOW_REGISTER', TRUE); //default level of error reporting in application. Developers should override it in their config.inc.php: set to E_ALL. @define ('ERROR_REPORTING', E_ALL & ~E_NOTICE); diff --git a/themes/baggy/login.twig b/themes/baggy/login.twig index 58290e9c..7906cc20 100644 --- a/themes/baggy/login.twig +++ b/themes/baggy/login.twig @@ -31,4 +31,9 @@ {% endif %} + {% if constant('ALLOW_REGISTER') == 1 %} +
+ {% trans "Register" %} +
+ {% endif %} {% endblock %} diff --git a/themes/baggy/register.twig b/themes/baggy/register.twig new file mode 100644 index 00000000..5744a481 --- /dev/null +++ b/themes/baggy/register.twig @@ -0,0 +1,25 @@ +{% extends "layout-login.twig" %} +{% block content %} + +

{% trans 'Add user' %}

+
+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+ +{% 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 @@ {% endif %} + {% if constant('ALLOW_REGISTER') == 1 %} +
+ {% trans "Register" %} +
+ {% endif %} {% 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 @@ +

{% trans 'Add user' %}

+
+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
\ No newline at end of file -- cgit v1.2.3 From 1fbef3bfb57b3f73e6817115f10b5876dd0e57ef Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 24 Jan 2015 12:54:58 +0100 Subject: resetting debug to false --- inc/poche/config.inc.default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/poche/config.inc.default.php b/inc/poche/config.inc.default.php index 3156b56c..000faf1c 100755 --- a/inc/poche/config.inc.default.php +++ b/inc/poche/config.inc.default.php @@ -31,7 +31,7 @@ @define ('SSL_PORT', 443); @define ('MODE_DEMO', FALSE); -@define ('DEBUG_POCHE', TRUE); +@define ('DEBUG_POCHE', FALSE); @define ('ALLOW_REGISTER', TRUE); -- cgit v1.2.3 From dc6ec987585a1c51f678c404143e37b0d844d796 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 13 Feb 2015 19:14:56 +0100 Subject: just a reminder --- inc/poche/config.inc.default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/poche/config.inc.default.php b/inc/poche/config.inc.default.php index fbf4ae9a..0fd9bc0e 100755 --- a/inc/poche/config.inc.default.php +++ b/inc/poche/config.inc.default.php @@ -60,7 +60,7 @@ @define ('PDF', FALSE); // registration -@define ('SEND_CONFIRMATION_EMAIL', TRUE); +@define ('SEND_CONFIRMATION_EMAIL', TRUE); // TO BE CHANGED DEPENDING ON POLL // display or not print link in article view @define ('SHOW_PRINTLINK', '1'); -- cgit v1.2.3 From f2321633b9dcc806b3c036a742bde1e4c9bcbef9 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 13 Feb 2015 19:39:48 +0100 Subject: couple improvements, translations --- inc/poche/Poche.class.php | 8 ++++++-- inc/poche/Routing.class.php | 2 +- inc/poche/config.inc.default.php | 3 +-- locale/en_US.utf8/LC_MESSAGES/en_US.utf8.mo | Bin 17302 -> 17420 bytes locale/en_US.utf8/LC_MESSAGES/en_US.utf8.po | 3 +++ locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo | Bin 22690 -> 22813 bytes locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po | 3 +++ 7 files changed, 14 insertions(+), 5 deletions(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index cd7578e3..a91a3f8f 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -93,7 +93,9 @@ class Poche _('This is an automatically generated message, no one will answer if you respond to it.'); // if external (public) registration - $body = "Hi, " . $newUsername . "\r\n\r\nYou've just created a wallabag account on " . Tools::getPocheUrl() . ".\r\nHave fun with it !"; + $body = sprintf(_('Hi, %1$s'), $newUsername) . "\r\n\r\n" . + sprintf(_('You\'ve just created a wallabag account on %1$s.'), Tools::getPocheUrl()) . + "\r\n\r\n" . _("Have fun with it !"); $body = $internalRegistration ? $body_internal : $body; $body = wordwrap($body, 70, "\r\n"); // cut lines with more than 70 caracters (MIME standard) @@ -117,7 +119,9 @@ class Poche $this->messages->add('i', _('The user was created, but no email was sent because email was not filled in')); } Tools::logm('The new user ' . $newUsername . ' has been installed'); - $this->messages->add('s', sprintf(_('The new user %s has been installed. Do you want to logout ?'), $newUsername)); + if (\Session::isLogged()) { + $this->messages->add('s', sprintf(_('The new user %s has been installed. Do you want to logout ?'), $newUsername)); + } Tools::redirect(); } else { diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php index e9b67771..177b74d5 100755 --- a/inc/poche/Routing.class.php +++ b/inc/poche/Routing.class.php @@ -72,7 +72,7 @@ class Routing Tools::logm('register'); $tplFile = Tools::getTplFile('register'); } elseif (ALLOW_REGISTER && isset($_GET['register'])){ - $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser']); + $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser'], $_POST['newuseremail']); Tools::redirect(); } elseif(isset($_SERVER['PHP_AUTH_USER'])) { if($this->wallabag->store->userExists($_SERVER['PHP_AUTH_USER'])) { diff --git a/inc/poche/config.inc.default.php b/inc/poche/config.inc.default.php index e569dddd..7c27856d 100755 --- a/inc/poche/config.inc.default.php +++ b/inc/poche/config.inc.default.php @@ -33,8 +33,6 @@ @define ('MODE_DEMO', FALSE); @define ('DEBUG_POCHE', FALSE); -@define ('ALLOW_REGISTER', TRUE); - //default level of error reporting in application. Developers should override it in their config.inc.php: set to E_ALL. @define ('ERROR_REPORTING', E_ALL & ~E_NOTICE); @@ -63,6 +61,7 @@ // registration @define ('SEND_CONFIRMATION_EMAIL', TRUE); // TO BE CHANGED DEPENDING ON POLL +@define ('ALLOW_REGISTER', TRUE); // display or not print link in article view @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..4341e50e 100644 Binary files a/locale/en_US.utf8/LC_MESSAGES/en_US.utf8.mo and b/locale/en_US.utf8/LC_MESSAGES/en_US.utf8.mo 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..37d926f1 100644 --- a/locale/en_US.utf8/LC_MESSAGES/en_US.utf8.po +++ b/locale/en_US.utf8/LC_MESSAGES/en_US.utf8.po @@ -673,6 +673,9 @@ msgstr "Hi, %1$s" msgid "Someone just created a wallabag account for you on %1$s." msgstr "Someone just created a wallabag account for you on %1$s." +msgid "You've just created a wallabag account on %1$s" +msgstr "You've just created a wallabag account on %1$s" + msgid "Your login is %1$s." msgstr "Your login is %1$s." 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..1004c1a0 100644 Binary files a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo and b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo 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..e0ee574e 100644 --- a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po +++ b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po @@ -800,6 +800,9 @@ msgid "Someone just created a wallabag account for you on %1$s." msgstr "" "Quelqu'un vient juste de créer un compte wallabag pour vous à l'adresse %1$s." +msgid "You've just created a wallabag account on %1$s" +msgstr "Vous venez juste de vous créer un compte wallabag sur %1$s" + msgid "Your login is %1$s." msgstr "Votre identifiant is %1$s." -- cgit v1.2.3 From 698eda739e705f5605711af927eb5e3720c7c97c Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 14 Feb 2015 12:35:22 +0100 Subject: mainly css improvements --- inc/poche/Poche.class.php | 4 ++- inc/poche/config.inc.default.php | 2 +- locale/en_US.utf8/LC_MESSAGES/en_US.utf8.mo | Bin 17420 -> 17544 bytes locale/en_US.utf8/LC_MESSAGES/en_US.utf8.po | 15 +++++++--- locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo | Bin 22813 -> 22961 bytes locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po | 14 ++++++++-- themes/baggy/login.twig | 10 +++---- themes/baggy/register.twig | 41 +++++++++++++++------------- 8 files changed, 54 insertions(+), 32 deletions(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index a91a3f8f..e37d7c6c 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -85,7 +85,7 @@ class Poche if ($email != "") { // if email is filled if (SEND_CONFIRMATION_EMAIL && function_exists('mail')) { - // if internal registration + // if internal registration from config screen $body_internal = _('Hi,') . "\r\n\r\n" . sprintf(_('Someone just created a wallabag account for you on %1$s.'), Tools::getPocheUrl()) . "\r\n\r\n" . sprintf(_('Your login is %1$s.'), $newUsername) ."\r\n\r\n" . _('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" . @@ -96,6 +96,7 @@ class Poche $body = sprintf(_('Hi, %1$s'), $newUsername) . "\r\n\r\n" . sprintf(_('You\'ve just created a wallabag account on %1$s.'), Tools::getPocheUrl()) . "\r\n\r\n" . _("Have fun with it !"); + $body = $internalRegistration ? $body_internal : $body; $body = wordwrap($body, 70, "\r\n"); // cut lines with more than 70 caracters (MIME standard) @@ -105,6 +106,7 @@ class Poche "From: " . $newUsername . "@" . gethostname() . "\r\n")) { Tools::logm('The user ' . $newUsername . ' has been emailed'); $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)); + Tools::redirect('?'); } else { Tools::logm('A problem has been encountered while sending an email'); diff --git a/inc/poche/config.inc.default.php b/inc/poche/config.inc.default.php index 7c27856d..6750383e 100755 --- a/inc/poche/config.inc.default.php +++ b/inc/poche/config.inc.default.php @@ -60,7 +60,7 @@ @define ('PDF', FALSE); // registration -@define ('SEND_CONFIRMATION_EMAIL', TRUE); // TO BE CHANGED DEPENDING ON POLL +@define ('SEND_CONFIRMATION_EMAIL', FALSE); @define ('ALLOW_REGISTER', TRUE); // display or not print link in article view 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 4341e50e..f2c8a0f6 100644 Binary files a/locale/en_US.utf8/LC_MESSAGES/en_US.utf8.mo and b/locale/en_US.utf8/LC_MESSAGES/en_US.utf8.mo 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 37d926f1..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" msgid "Return home" msgstr "Return home" -msgid "Back to top" -msgstr "Back to top" +msgid "back" +msgstr "back" msgid "Mark as read" msgstr "Mark as read" @@ -435,6 +435,9 @@ msgstr "Save a Link" msgid "back to home" msgstr "Back to Home" +msgid "back to login" +msgstr "back to login" + msgid "toggle mark as read" msgstr "Toggle mark as read" @@ -705,8 +708,12 @@ msgstr "" "The new user %1$s has been sent an email at %2$s. You may have to check spam " "folder." -msgid "A problem has been encountered while sending the confirmation email" -msgstr "A problem has been encountered while sending an confirmation email" +msgid "" +"A problem has been encountered while sending the confirmation email, but the " +"user was created." +msgstr "" +"A problem has been encountered while sending an confirmation email, but the " +"user was created." msgid "The server did not authorize sending a confirmation email" 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 1004c1a0..1f1995b8 100644 Binary files a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo and b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo 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 e0ee574e..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" msgid "back to home" msgstr "retour à l'accueil" +msgid "back" +msgstr "retour" + msgid "favorites" msgstr "favoris" @@ -357,6 +360,9 @@ msgstr "Tweet" msgid "Email" msgstr "E-mail" +msgid "Email (not required)" +msgstr "E-mail (non requis)" + msgid "shaarli" msgstr "Shaarli" @@ -835,8 +841,12 @@ msgstr "" msgid "A problem has been encountered while sending the confirmation email" msgstr "Un problème a été rencontré lors de l'envoi de l'email de confirmation" -msgid "The server did not authorize sending a confirmation email" -msgstr "Le serveur n'autorise pas l'envoi d'un email de confirmation" +msgid "" +"The server did not authorize sending a confirmation email, but the user was " +"created." +msgstr "" +"Le serveur n'autorise pas l'envoi d'un email de confirmation, mais " +"l'utilisateur a été créé." msgid "" "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 7906cc20..d941ca93 100644 --- a/themes/baggy/login.twig +++ b/themes/baggy/login.twig @@ -26,14 +26,14 @@
+ {% if constant('ALLOW_REGISTER') == 1 %} + + {% endif %} {% endif %} - {% if constant('ALLOW_REGISTER') == 1 %} - - {% endif %} {% endblock %} diff --git a/themes/baggy/register.twig b/themes/baggy/register.twig index 5744a481..e2c56c73 100644 --- a/themes/baggy/register.twig +++ b/themes/baggy/register.twig @@ -1,25 +1,28 @@ {% extends "layout-login.twig" %} {% block content %} +

{% trans 'Add user' %}

- -
-
- - -
-
- - -
-
- - -
-
- -
-
-
+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ +
+ {% endblock %} \ No newline at end of file -- cgit v1.2.3 From 952faeeb312e7461e4ca69fb236c14ee780d3fc5 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 14 Feb 2015 12:36:00 +0100 Subject: forgot this file --- inc/poche/Poche.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index e37d7c6c..6d4ce137 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -114,7 +114,7 @@ class Poche } } else { Tools::logm('The user has been created, but the server did not authorize sending emails'); - $this->messages->add('i', _('The server did not authorize sending a confirmation email')); + $this->messages->add('i', _('The server did not authorize sending a confirmation email, but the user was created.')); } } else { Tools::logm('The user has been created, but no email was saved, so no confimation email was sent'); -- cgit v1.2.3