improvements to internal registration and translations

This commit is contained in:
Thomas Citharel 2015-02-13 19:10:22 +01:00
parent 57068585c0
commit 6cb5e1c9f5
6 changed files with 136 additions and 16 deletions

View file

@ -81,16 +81,27 @@ class Poche
$email = filter_var($email, FILTER_SANITIZE_STRING);
if (!$this->store->userExists($newUsername)){
if ($this->store->install($newUsername, Tools::encodeString($password . $newUsername), $email)) {
if ($email != "") { // if email is filled
if (SEND_CONFIRMATION_EMAIL && function_exists('mail')) {
// if internal registration
$body_internal = "Hi,\r\n\r\nSomeone just created an account for you on " . Tools::getPocheUrl() . ".\r\nHave fun with it !";
$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" .
_('Have fun with it !') . "\r\n\r\n" .
_('This is an automatically generated message, no one will answer if you respond to it.');
// if external (public) registration
$body = "Hi, \r\n\r\nYou've just created an account on " . Tools::getPocheUrl() . ".\r\nHave fun with it !";
$body = "Hi, " . $newUsername . "\r\n\r\nYou've just created a wallabag account on " . Tools::getPocheUrl() . ".\r\nHave fun with it !";
$body = $internalRegistration ? $body_internal : $body;
$body = wordwrap($body, 70, "\r\n"); // cut lines with more than 70 caracters (MIME standard)
if (mail($email, sprintf(_('Your new wallabag account on '), Tools::getPocheUrl()), $body, 'X-Mailer: PHP/' . phpversion())) {
if (mail($email, sprintf(_('Your new wallabag account on %1$s'), Tools::getPocheUrl()), $body,
'X-Mailer: PHP/' . phpversion() . "\r\n" .
'Content-type: text/plain; charset=UTF-8' . "\r\n" .
"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.'), $newUsername, $email));
$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));
} else {
Tools::logm('A problem has been encountered while sending an email');
@ -98,7 +109,11 @@ 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 an email'));
$this->messages->add('i', _('The server did not authorize sending a confirmation email'));
}
} else {
Tools::logm('The user has been created, but no email was saved, so no confimation email was sent');
$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 <a href="?logout">logout ?</a>'), $newUsername));

View file

@ -59,6 +59,9 @@
@define ('MOBI', FALSE);
@define ('PDF', FALSE);
// registration
@define ('SEND_CONFIRMATION_EMAIL', TRUE);
// display or not print link in article view
@define ('SHOW_PRINTLINK', '1');
// display or not percent of read in article view. Affects only default theme.

View file

@ -663,6 +663,56 @@ msgstr "Download the articles from this search in an EPUB"
msgid "Download the articles from this category in an epub"
msgstr "Download the articles from this category in an EPUB"
# registration
msgid "Hi,"
msgstr "Hi,"
msgid "Hi, %1$s"
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 "Your login is %1$s."
msgstr "Your login is %1$s."
msgid "Have fun with it !"
msgstr "Have fun with it !"
msgid ""
"This is an automatically generated message, no one will answer if you "
"respond to it."
msgstr ""
"This is an automatically generated message, no one will answer if you "
"respond to it."
msgid ""
"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"
msgstr ""
"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"
msgid ""
"The new user %1$s has been sent an email at %2$s. You may have to check spam "
"folder."
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 "The server did not authorize sending a confirmation email"
msgstr "The server did not authorize sending a confirmation email"
msgid ""
"The user was created, but no email was sent because email was not filled in"
msgstr ""
"The user was created, but no email was sent because email was not filled in"
#~ msgid "poche it!"
#~ msgstr "poche it!"

View file

@ -789,6 +789,58 @@ msgstr ""
msgid "Produced by wallabag with PHPMobi"
msgstr "Produit par wallabag avec PHPMobi"
# registration
msgid "Hi,"
msgstr "Salut,"
msgid "Hi, %1$s"
msgstr "Salut, %1$s"
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 "Your login is %1$s."
msgstr "Votre identifiant is %1$s."
msgid "Have fun with it !"
msgstr "Amusez-vous bien !"
msgid ""
"This is an automatically generated message, no one will answer if you "
"respond to it."
msgstr ""
"Ceci est un message généré automatiquement, personne ne vous répondra si "
"vous y répondez."
msgid ""
"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"
msgstr ""
"Note : Votre mot de passe a été défini par la personne ayant créé votre "
"compte. Vous devriez entrer en contact avec cette personne pour connaître "
"votre mot de passe et le changer dès que possible"
msgid ""
"The new user %1$s has been sent an email at %2$s. You may have to check spam "
"folder."
msgstr ""
"Un email a été envoyé au nouvel utiliateur %1$s à l'adresse %2$s. Il peut "
"être nécessaire de vérifier le dossier des spams."
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 user was created, but no email was sent because email was not filled in"
msgstr ""
"L'utilisateur a été créé, mais aucun mail n'a été envoyé car l'email n'était "
"pas renseigné"
msgid "Mail function is disabled. You can't send emails from your server"
msgstr ""
"La fonction mail est désactivée. Vous ne pouvez pas envoyer d'E-mails depuis "