summaryrefslogtreecommitdiff
path: root/src/user.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/user.cpp')
-rw-r--r--src/user.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/user.cpp b/src/user.cpp
index dddde30..3a21504 100644
--- a/src/user.cpp
+++ b/src/user.cpp
@@ -63,9 +63,14 @@ void user::register_user( )
if( request( ).request_method( ) == "POST" ) {
c.register_user.load( context( ) );
if( c.register_user.validate( ) ) {
+ cms.mail.subject = "Registration request";
+ cms.mail.body = "Your registration code is: CODE";
+ cms.mail.to = c.register_user.email.value( );
+ cms.mail.send( );
response( ).set_redirect_header( cms.root( ) + "/confirm_register" );
}
}
+
render( "register_user", c );
}
@@ -202,6 +207,8 @@ register_user_form::register_user_form( apps::strusCms &cms )
password.error_message( "Your password is illegal" );
password2.message( "Your password (again)" );
password2.error_message( "Your password doesn't match" );
+ email.message( "Email" );
+ email.error_message( "Your email address is not valid" );
captcha.message( "Enter the correct captcha" );
captcha.error_message( "Captcha didn't match" );
submit.value( "Register user" );
@@ -209,12 +216,14 @@ register_user_form::register_user_form( apps::strusCms &cms )
add( username );
add( password );
add( password2 );
+ add( email );
add( captcha );
add( submit );
username.non_empty( );
password.non_empty( );
password2.non_empty( );
+ email.non_empty( );
captcha.non_empty( );
}
@@ -243,6 +252,7 @@ bool register_user_form::validate( )
if( captcha.value( ).compare( cms.user.last_captcha ) != 0 ) {
captcha.valid( false );
captcha.clear( );
+ booster::ptime::sleep( booster::ptime( 5, 0 ) );
return false;
}