aboutsummaryrefslogtreecommitdiffstats
path: root/register.php
diff options
context:
space:
mode:
Diffstat (limited to 'register.php')
-rw-r--r--register.php55
1 files changed, 21 insertions, 34 deletions
diff --git a/register.php b/register.php
index dfc5ac487..993fe169d 100644
--- a/register.php
+++ b/register.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based photo gallery |
// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2013 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
@@ -44,49 +44,36 @@ if (isset($_POST['submit']))
if (!verify_ephemeral_key(@$_POST['key']))
{
set_status_header(403);
- array_push($page['errors'], 'Invalid/expired form key');
+ $page['errors'][] = l10n('Invalid/expired form key');
}
- if ($_POST['password'] != $_POST['password_conf'])
+ if(empty($_POST['password']))
{
- array_push($page['errors'], l10n('please enter your password again'));
+ $page['errors'][] = l10n('Password is missing. Please enter the password.');
+ }
+ else if(empty($_POST['password_conf']))
+ {
+ $page['errors'][] = l10n('Password confirmation is missing. Please confirm the chosen password.');
+ }
+ else if ($_POST['password'] != $_POST['password_conf'])
+ {
+ $page['errors'][] = l10n('The passwords do not match');
}
- $page['errors'] =
- register_user($_POST['login'],
- $_POST['password'],
- $_POST['mail_address'],
- true,
- $page['errors']);
+ register_user(
+ $_POST['login'],
+ $_POST['password'],
+ $_POST['mail_address'],
+ true,
+ $page['errors'],
+ isset($_POST['send_password_by_mail'])
+ );
if (count($page['errors']) == 0)
{
// email notification
- if (isset($_POST['send_password_by_mail']) and isset($_POST['mail_address']))
+ if (isset($_POST['send_password_by_mail']) and email_check_format($_POST['mail_address']))
{
- include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
-
- $keyargs_content = array(
- get_l10n_args('Hello %s,', $_POST['login']),
- get_l10n_args('Thank you for registering at %s!', $conf['gallery_title']),
- get_l10n_args('', ''),
- get_l10n_args('Here are your connection settings', ''),
- get_l10n_args('Username: %s', $_POST['login']),
- get_l10n_args('Password: %s', $_POST['password']),
- get_l10n_args('Email: %s', $_POST['mail_address']),
- get_l10n_args('', ''),
- get_l10n_args('If you think you\'ve received this email in error, please contact us at %s', get_webmaster_mail_address()),
- );
-
- pwg_mail(
- $_POST['mail_address'],
- array(
- 'subject' => '['.$conf['gallery_title'].'] '.l10n('Registration'),
- 'content' => l10n_args($keyargs_content),
- 'content_format' => 'text/plain',
- )
- );
-
$_SESSION['page_infos'][] = l10n('Successfully registered, you will soon receive an email with your connection settings. Welcome!');
}