[vhffs-dev] Mail delivery failed: returning message to sender |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
jul@xxxxxxxxxxxxxxxx
SMTP error from remote mailer after RCPT TO:<jul@xxxxxxxxxxxxxxxx>:
host smtp.secureserver.net [64.202.166.12]: 553 sorry, relaying denied from your location [212.85.158.3] (#5.7.1)
------ This is a copy of the message, including all the headers. ------
Return-path: <vhffs-dev@xxxxxxxxx>
Received: from localhost ([127.0.0.1] helo=tuxfamily.org)
by mx1.tuxfamily.net with esmtp (Exim 4.50)
id 1GZWjH-0002EX-LC
for jul@xxxxxxxxxxxxxxxx; Mon, 16 Oct 2006 19:58:23 +0200
Received: from delmak.naquadah.org ([212.85.153.235]
helo=mx1.naquadah.org) by mx1.tuxfamily.net with esmtp (Exim 4.50) id
1GZWjF-0002Dt-Oc for vhffs-dev@xxxxxxxxx; Mon, 16 Oct 2006 19:58:21 +0200
Received: from root by mx1.naquadah.org with local (Exim 4.50) id
1GZWjB-0004ZB-5r for vhffs-dev@xxxxxxxxx; Mon, 16 Oct 2006 19:58:17 +0200
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Subject: [vhffs-dev] [svn] commit: r227 - in /trunk/vhffs-panel:
subscribe.pl subscribe_complete.pl templates/user/create.tmpl
Date: Mon, 16 Oct 2006 17:58:17 -0000
To: vhffs-dev@xxxxxxxxx
From: vhffs-dev@xxxxxxxxx
X-Mailer: svnmailer-1.0.7
Message-Id: <E1GZWjB-0004ZB-5r@xxxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:vhffs-dev-request@xxxxxxxxx?subject=unsubscribe>
List-Subscribe: <mailto:vhffs-dev-request@xxxxxxxxx?subject=subscribe>
List-Help: <mailto:vhffs-dev-request@xxxxxxxxx?subject=help>
List-Software: Listengine 4.0, VHFFS 4.0
List-Id: vhffs-dev.vhffs.org
Reply-To: vhffs-dev@xxxxxxxxx
Author: gradator
Date: Mon Oct 16 19:58:16 2006
New Revision: 227
Log:
remove intermediate script (subscribe_complete.pl), no need to fill again t=
he form on error
Removed:
trunk/vhffs-panel/subscribe_complete.pl
Modified:
trunk/vhffs-panel/subscribe.pl
trunk/vhffs-panel/templates/user/create.tmpl
Modified: trunk/vhffs-panel/subscribe.pl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/vhffs-panel/subscribe.pl (original)
+++ trunk/vhffs-panel/subscribe.pl Mon Oct 16 19:58:16 2006
@@ -29,53 +29,223 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE=20
# POSSIBILITY OF SUCH DAMAGE.
=20
-
-
-use strict;
+# subscribe.pl
+# Handle subscription for VHFFS
+# If the subscribe form has been submitted
+# we try to create the user, else display
+# the form. If there is an error we inform the
+# user and redisplay the form (already filled)
+#
+
+use POSIX qw(locale_h);
use CGI;
use locale;
+use Locale::gettext;
+use HTML::Template;
+
+use Vhffs::User;
use Vhffs::Main;
+use Vhffs::Functions;
use Vhffs::Constants;
use Vhffs::Panel::Main;
use Vhffs::Panel::Confirmation;
-use POSIX qw(locale_h);
-use HTML::Template;
-use Locale::gettext;
-
-my $vhffs =3D init Vhffs::Main;
-my $templatedir =3D $vhffs->get_config->get_templatedir;
-my $template;
-my $confirmation;
+
+#Get some basics informations with CGI
+my $cgi;
+my $uid;
+my $good_news;
+my $vhffs;
+my $templatedir;
+my $cid;
+my $realcode;
+my $code;
+
+$cgi =3D new CGI;
+
+#Initialize vars
+$good_news =3D "";
+
+#Init the Vhffs Main System
+$vhffs =3D init Vhffs::Main;
+$templatedir =3D $vhffs->get_config->get_templatedir;
=20
Vhffs::Panel::Main::check( $vhffs );
Vhffs::Panel::Main::cook_lang( $vhffs );
=20
+
+$submitted =3D $cgi->param( "CREATE_SUBMIT" );
+$mail =3D $cgi->param( "MAIL" );
+$username =3D $cgi->param( "USERNAME" );
+$firstname =3D $cgi->param( "FIRSTNAME");
+$lastname =3D $cgi->param( "LASTNAME" );
+$city =3D $cgi->param("CITY");
+$zipcode =3D $cgi->param("ZIPCODE");
+$country =3D $cgi->param("COUNTRY");
+$address =3D $cgi->param("ADDRESS");
+$cid =3D $cgi->param("CID");
+$code =3D $cgi->param("CONFIRMATION");
+$realcode =3D Vhffs::Panel::Confirmation::get_code( $vhffs , $cid );
+
+my $template;
+my $message;
+
if( $vhffs->get_config->get_allow_subscribe =3D=3D 0 )
{
- $template =3D new HTML::Template( filename =3D> $templatedir."/misc/simpl=
emsg.tmpl");
- $template->param( MESSAGE =3D> gettext("You cannot subscribe to VHFFS") );
+# Subscribe isn't allow, inform user
+ $template =3D new HTML::Template( filename =3D> $templatedir."/mis=
c/simplemsg.tmpl");
+ $template->param( MESSAGE =3D> gettext("You cannot subscribe to VH=
FFS") );
+} elsif( defined $submitted ) {
+# don't check if form hasn't been submitted
+ @errors =3D ();
+ if( ( ! defined $cid ) || ( ! defined $code ) || ( $code ne $realcode ) )
+ {
+ push(@errors, {error =3D> gettext("Codes do not match")});
+ }
+ if( ! defined $username )
+ {
+ push(@errors, {error =3D> gettext("You must declare your username")});
+ }
+ if( ( length ( $username ) < 3 ) || ( length ( $username ) > 12 ) )
+ {
+ push(@errors, {error =3D> gettext("Username must contain between 3 and 1=
2 characters")});
+ }
+ if( ! defined $country )
+ {
+ push(@errors, {error =3D> gettext("You must declare your country")});
+ }
+ if( ! defined $city )
+ {
+ push(@errors, {error =3D> gettext("You must declare your city")});
+ }
+ if( ! defined $zipcode )
+ {
+ push(@errors, {error =3D> gettext("You must declare your zipcode")});
+ }
+ if( ! defined $firstname )
+ {
+ push(@errors, {error =3D> gettext("You must declare your firstname")});
+ }
+ if( ! defined $lastname )
+ {
+ push(@errors, {error =3D> gettext("You must declare your lastname")});
+ }
+ if( ( ! defined $mail ) || ( length( $mail ) < 6 ) )
+ {
+ push(@errors, {error =3D> gettext("You must declare your mail address")}=
);
+ }
+ if( Vhffs::Functions::valid_mail( $mail ) =3D=3D -1 )
+ {
+ push(@errors, {error =3D> gettext("You must declare a valid mail address=
")});
+ }
+ if( ! ( $zipcode =3D~ /^[\d]+$/ ) )
+ {
+ push(@errors, {error =3D> gettext("Your zipcode is not correct! Please e=
nter a correct zipcode")});
+ }
+ if( ! ( $firstname =3D~ /^[\w\d\s\-]+$/ ) )
+ {
+ push(@errors, {error =3D> gettext("Please enter a correct =
firstname")});
+ }
+ if( ! ( $lastname =3D~ /^[\w\d\s\-]+$/ ) )
+ {
+ push(@errors, {error =3D> gettext("Please enter a correct =
firstname")});
+ }
+ if( ! ( $city =3D~ /^[^(\(\)\\\.\_\e\'\")]+$/ ) )
+ {
+ push(@errors, {error =3D> gettext("Please enter a correct =
city")});
+ }
+ if( ! ( $country =3D~ /^[\w\d\s\-\s]+$/ ) )
+ {
+ push(@errors, {error =3D> gettext("Please enter a correct coun=
try")});
+ }
+
+ if( ( scalar @errors ) =3D=3D 0)
+ {
+ my $retour;
+ my $user =3D new Vhffs::User( $vhffs , $username , '401' );
+ if( defined $user )
+ {
+ $uid =3D $user->create;
+ =09
+ if( $uid < 0 )
+ {
+ #If the API returns a negative value as uid, the user cannot be crea=
ted !
+ push( @errors, {error =3D> gettext("Cannot create user, the username=
you entered already exists")});
+ }
+ else
+ {
+ #Get user information
+ $user->fetch;
+ =20
+ #We set informations user fill in the form
+ $user->set_mail( $mail );
+ $user->set_firstname( $firstname );
+ $user->set_lastname( $lastname );
+ $user->set_city( $city );
+ $user->set_zipcode( $zipcode );
+ $user->set_country( $country );
+ $user->set_address( $address );
+ $user->set_status( Vhffs::Constants::WAITING_FOR_CREATION );
+ $user->set_password( Vhffs::Functions::generate_random_password ); =09
+ =20
+ #Commit all the changes for the current user
+ if( ( $retour =3D $user->commit ) < 0 )
+ {
+ push ( @errors, { error =3D> gettext("Cannot apply changes to the user"=
) } );
+ }
+ else
+ {
+ $good_news =3D gettext("User Successfully created");
+ $good_news2 =3D gettext("Please wait while we are creating the account,=
it will take some minutes");
+ $template =3D new HTML::Template( filename =3D> $templatedir."/user/cre=
ate_complete.tmpl" );
+ $template->param( TEXT_BACK =3D> gettext("Back to Login") );
+ $template->param( GOOD_NEWS =3D> $good_news );
+ $template->param( GOOD_NEWS2 =3D> $good_news2 );
+ }
+ }
+ =09
+ } else {
+ push ( @errors, { error =3D> gettext("Cannot create user. Your username =
should contain at least 3 characters which are only lower case and digits."=
) } );
+ }
+ }
+ if ( ( scalar @errors ) > 0 ) {
+ $template =3D new HTML::Template( filename =3D> $templatedir."/user/c=
reate.tmpl" );
+ # There was an error, fill the template parameter
+ $template->param( ERRORS =3D> \@errors );
+ $template->param( USERNAME_VALUE =3D> $username );
+ $template->param( MAIL_VALUE =3D> $mail );
+ $template->param( FIRSTNAME_VALUE =3D> $firstname );
+ $template->param( LASTNAME_VALUE =3D> $lastname );
+ $template->param( ZIPCODE_VALUE =3D> $zipcode );
+ $template->param( CITY_VALUE =3D> $city );
+ $template->param( COUNTRY_VALUE =3D> $country );
+ $template->param( ADDRESS_VALUE =3D> $address );
+
+ }
+} else {
+ $template =3D new HTML::Template( filename =3D> $templatedir."/user/cr=
eate.tmpl" );
}
-else
-{
- $template =3D new HTML::Template( filename =3D> $templatedir."/user/cre=
ate.tmpl" );
- $confirmation =3D Vhffs::Panel::Confirmation::create_code( $vhffs );
-=09
- $template->param( TITLE =3D> gettext("Subscription ") );
- $template->param( TEXT_SUBSCRIBE =3D> gettext("Subscription") );
- $template->param( TEXT_INFOS =3D> gettext("Please fill in all fields, a=
mail containing your password will be sent to you") );
- $template->param( USERNAME_TEXT =3D> gettext("Username") );
- $template->param( MAIL_TEXT =3D> gettext("mail") );
- $template->param( FIRSTNAME_TEXT =3D> gettext("Firstname") );
- $template->param( LASTNAME_TEXT =3D> gettext("Lastname") );
- $template->param( ZIPCODE_TEXT =3D> gettext("Zipcode") );
- $template->param( CITY_TEXT =3D> gettext("City") );
- $template->param( COUNTRY_TEXT =3D> gettext("Country") );
- $template->param( ADDRESS_TEXT =3D> gettext("Address") );
- $template->param( SEND =3D> gettext("Subscribe") );
- $template->param( BACK =3D> gettext("Back to Login") );
- $template->param( CONFIRMATION_TEXT =3D> gettext("Code confirmation") );
- $template->param( REPEAT_CONFIRMATION_TEXT =3D> gettext("Recopy the code"=
) );
- $template->param( CID =3D> $confirmation->[0] );
+
+if( ( ! defined $submitted ) || ( ( defined @errors) && ( (scalar @errors)=
!=3D 0 ) ) ) {
+ $confirmation =3D Vhffs::Panel::Confirmation::create_code( $vhffs );
+
+# $template is defined in every cases
+
+ $template->param( TEXT_SUBSCRIBE =3D> gettext("Subscription") );
+ $template->param( TEXT_INFOS =3D> gettext("Please fill in a=
ll fields, a mail containing your password will be sent to you") );
+ $template->param( USERNAME_TEXT =3D> gettext("Username") );
+ $template->param( MAIL_TEXT =3D> gettext("mail") );
+ $template->param( FIRSTNAME_TEXT =3D> gettext("Firstname") );
+ $template->param( LASTNAME_TEXT =3D> gettext("Lastname") );
+ $template->param( ZIPCODE_TEXT =3D> gettext("Zipcode") );
+ $template->param( CITY_TEXT =3D> gettext("City") );
+ $template->param( COUNTRY_TEXT =3D> gettext("Country") );
+ $template->param( ADDRESS_TEXT =3D> gettext("Address") );
+ $template->param( SEND =3D> gettext("Subscribe") );
+ $template->param( BACK =3D> gettext("Back to Login") =
);
+ $template->param( CONFIRMATION_TEXT =3D> gettext("Code confirmatio=
n") );
+ $template->param( REPEAT_CONFIRMATION_TEXT =3D> gettext("Recopy t=
he code") );
+ $template->param( CID =3D> $confirmation->[0] );
+
}
-
+$template->param( TITLE =3D> gettext("Subscribe") );
display_light Vhffs::Panel::Main($template);
Modified: trunk/vhffs-panel/templates/user/create.tmpl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/vhffs-panel/templates/user/create.tmpl (original)
+++ trunk/vhffs-panel/templates/user/create.tmpl Mon Oct 16 19:58:16 2006
@@ -18,71 +18,75 @@
<h1><tmpl_var name=3D"TEXT_SUBSCRIBE"></h1>
=09
<div class=3D"subscribe">
- <form method=3D"post" action=3D"subscribe_complete.pl">
+ <form method=3D"post" action=3D"subscribe.pl">
+ <tmpl_loop name=3D"ERRORS">
+ <p style=3D"font-weight:bold;color:red;"><=
tmpl_var name=3D"ERROR"></p>
+ </tmpl_loop>
<h2><tmpl_var name=3D"TEXT_INFOS"></h2>
+
<p>
<label for=3D"USERNAME">
<TMPL_VAR NAME=3D"USERNAME_TEXT">
</label>
- <input type=3D"text" name=3D"USERNAME" id=3D"USERNAME" maxlength=3D"3=
2"/>
+ <input type=3D"text" name=3D"USERNAME" id=3D"USERNAME" maxlength=3D"3=
2" value=3D"<TMPL_VAR NAME=3D"USERNAME_VALUE">"/>
</p>
<p>
<label for=3D"MAIL">
<TMPL_VAR NAME=3D"MAIL_TEXT">
</label>
- <input type=3D"text" name=3D"MAIL" id=3D"MAIL" maxlength=3D"32" />
+ <input type=3D"text" name=3D"MAIL" id=3D"MAIL" maxlength=3D"32" value=
=3D"<TMPL_VAR NAME=3D"MAIL_VALUE">"/>
</p>
<p>
<label for=3D"FIRSTNAME">
<TMPL_VAR NAME=3D"FIRSTNAME_TEXT">
</label>
- <input type=3D"text" name=3D"FIRSTNAME" id=3D"FIRSTNAME" maxlength=3D=
"256" />
+ <input type=3D"text" name=3D"FIRSTNAME" id=3D"FIRSTNAME" maxlength=3D=
"256" value=3D"<TMPL_VAR NAME=3D"FIRSTNAME_VALUE">" />
</p>
<p>
<label for=3D"LASTNAME">
<TMPL_VAR NAME=3D"LASTNAME_TEXT">
</label>
- <input type=3D"text" name=3D"LASTNAME" id=3D"LASTNAME" maxlength=3D"2=
56"/>
+ <input type=3D"text" name=3D"LASTNAME" id=3D"LASTNAME" maxlength=3D"2=
56" value=3D"<TMPL_VAR NAME=3D"LASTNAME_VALUE">"/>
</p>
<p>
<label for=3D"ADDRESS">
<TMPL_VAR NAME=3D"ADDRESS_TEXT">
</label>
- <input type=3D"text" name=3D"ADDRESS" id=3D"ADDRESS" maxlength=3D"512=
"/>
+ <input type=3D"text" name=3D"ADDRESS" id=3D"ADDRESS" maxlength=3D"512=
" value=3D"<TMPL_VAR NAME=3D"ADDRESS_VALUE">"/>
</p>
<p>
<label for=3D"CITY">
<TMPL_VAR NAME=3D"CITY_TEXT">
</label>
- <input type=3D"text" name=3D"CITY" id=3D"CITY" maxlength=3D"64"/>
+ <input type=3D"text" name=3D"CITY" id=3D"CITY" maxlength=3D"64" value=
=3D"<TMPL_VAR NAME=3D"CITY_VALUE">"/>
</p>
<p>
<label for=3D"COUNTRY">
<TMPL_VAR NAME=3D"COUNTRY_TEXT">
</label>
- <input type=3D"text" name=3D"COUNTRY" id=3D"COUNTRY" maxlength=3D"32"=
/>
+ <input type=3D"text" name=3D"COUNTRY" id=3D"COUNTRY" maxlength=3D"32"=
value=3D"<TMPL_VAR NAME=3D"COUNTRY_VALUE">"/>
</p>
<p>
<label for=3D"ZIPCODE">
<TMPL_VAR NAME=3D"ZIPCODE_TEXT">
</label>
- <input type=3D"text" name=3D"ZIPCODE" id=3D"ZIPCODE" maxlength=3D"16"=
/>
+ <input type=3D"text" name=3D"ZIPCODE" id=3D"ZIPCODE" maxlength=3D"16"=
value=3D"<TMPL_VAR NAME=3D"ZIPCODE_VALUE">"/>
</p>
<p>
- <label for=3D"ZIPCODE">
+ <label for=3D"CONFIRMATION">
<TMPL_VAR NAME=3D"CONFIRMATION_TEXT">
</label>
<img src=3D"show_code.pl?cid=3D<TMPL_VAR NAME=3D"CID">"/>
</p>
<p>
- <label for=3D"ZIPCODE">
+ <label for=3D"CONFIRMATION">
<TMPL_VAR NAME=3D"REPEAT_CONFIRMATION_TEXT">
</label>
- <input type=3D"text" name=3D"CONFIRMATION" maxlength=3D"16"/>
+ <input type=3D"text" name=3D"CONFIRMATION" id=3D"CONFIRMATION" maxle=
ngth=3D"16"/>
</p>
<p class=3D"button">
<input type=3D"hidden" name=3D"CID" value=3D"<TMPL_VAR NAME=3D"CID">"=
/>
- <input type=3D"submit" value=3D"<TMPL_VAR NAME=3D"SEND">" />
+ <input type=3D"submit" value=3D"<TMPL_VAR NAME=3D"SEND">" name=3D"CRE=
ATE_SUBMIT"/>
</p>
=09
</form>