diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php index 33873f0b7..3d500af69 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php @@ -84,10 +84,10 @@ class Users{ return "Username must be 5 or more characters."; }elseif ( !preg_match( '/^[a-z0-9\.]*$/', $username ) ){ return "Username can only contain numbers and letters."; - }elseif ( sql :: db_query( "SELECT COUNT(*) FROM {users} WHERE name = :name", array( + /*}elseif ( sql :: db_query( "SELECT COUNT(*) FROM {users} WHERE name = :name", array( ':name' => $username ) ) -> fetchField() ){ - return "Username " . $username . " is in use."; + return "Username " . $username . " is in use.";*/ }else{ return "success"; } @@ -139,12 +139,12 @@ class Users{ public function checkEmail( $email ) { if ( isset( $email ) ){ - if ( !validEmail( $email ) ){ + if ( !Users::validEmail( $email ) ){ return "Email address is not valid."; - }elseif ( db_query( "SELECT COUNT(*) FROM {users} WHERE mail = :mail", array( + /*}elseif ( db_query( "SELECT COUNT(*) FROM {users} WHERE mail = :mail", array( ':mail' => $email ) ) -> fetchField() ){ - return "Email is in use."; + return "Email is in use.";*/ }else{ return "success"; } @@ -153,49 +153,50 @@ class Users{ } return "fail"; } - public function validEmail( $email ) - { - $isValid = true; - $atIndex = strrpos( $email, "@" ); - if ( is_bool( $atIndex ) && !$atIndex ){ - $isValid = false; - }else{ - $domain = substr( $email, $atIndex + 1 ); - $local = substr( $email, 0, $atIndex ); - $localLen = strlen( $local ); - $domainLen = strlen( $domain ); - if ( $localLen < 1 || $localLen > 64 ){ - // local part length exceeded - $isValid = false; - }else if ( $domainLen < 1 || $domainLen > 255 ){ - // domain part length exceeded - $isValid = false; - }else if ( $local[0] == '.' || $local[$localLen - 1] == '.' ){ - // local part starts or ends with '.' - $isValid = false; - }else if ( preg_match( '/\\.\\./', $local ) ){ - // local part has two consecutive dots - $isValid = false; - }else if ( !preg_match( '/^[A-Za-z0-9\\-\\.]+$/', $domain ) ){ - // character not valid in domain part - $isValid = false; - }else if ( preg_match( '/\\.\\./', $domain ) ){ - // domain part has two consecutive dots - $isValid = false; - }else if ( !preg_match( '/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace( "\\\\", "", $local ) ) ){ - // character not valid in local part unless - // local part is quoted - if ( !preg_match( '/^"(\\\\"|[^"])+"$/', str_replace( "\\\\", "", $local ) ) ){ - $isValid = false; + + public function validEmail( $email ){ + $isValid = true; + $atIndex = strrpos( $email, "@" ); + if ( is_bool( $atIndex ) && !$atIndex ){ + $isValid = false; + }else{ + $domain = substr( $email, $atIndex + 1 ); + $local = substr( $email, 0, $atIndex ); + $localLen = strlen( $local ); + $domainLen = strlen( $domain ); + if ( $localLen < 1 || $localLen > 64 ){ + // local part length exceeded + $isValid = false; + }else if ( $domainLen < 1 || $domainLen > 255 ){ + // domain part length exceeded + $isValid = false; + }else if ( $local[0] == '.' || $local[$localLen - 1] == '.' ){ + // local part starts or ends with '.' + $isValid = false; + }else if ( preg_match( '/\\.\\./', $local ) ){ + // local part has two consecutive dots + $isValid = false; + }else if ( !preg_match( '/^[A-Za-z0-9\\-\\.]+$/', $domain ) ){ + // character not valid in domain part + $isValid = false; + }else if ( preg_match( '/\\.\\./', $domain ) ){ + // domain part has two consecutive dots + $isValid = false; + }else if ( !preg_match( '/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace( "\\\\", "", $local ) ) ){ + // character not valid in local part unless + // local part is quoted + if ( !preg_match( '/^"(\\\\"|[^"])+"$/', str_replace( "\\\\", "", $local ) ) ){ + $isValid = false; } - } - if ( $isValid && !( checkdnsrr( $domain, "MX" ) || checkdnsrr( $domain, "A" ) ) ){ - // domain not found in DNS - $isValid = false; - } - } - return $isValid; - } + } + if ( $isValid && !( checkdnsrr( $domain, "MX" ) || checkdnsrr( $domain, "A" ) ) ){ + // domain not found in DNS + $isValid = false; + } + } + return $isValid; + } + public function generateSALT( $length = 2 ) { // start with a blank salt diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini index e8291b26b..a1ad8d461 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini @@ -11,19 +11,23 @@ welcome_message = "Welcome! Please fill in the following fields to get your new username_tag = "Desired Username" username_tooltip = "5-12 lower-case characters and numbers. The login (username) you create here will be your login name. The name of your game characters will be chosen later on." +username_default = "Username" password_tag = "Desired Password" password_tooltip = "Pick a hard to guess password (5-20 characters)." password_message = "Password must be 5-20 characters." +password_default = "Password" cpassword_tag = "Confirm Password" cpassword_tooltip = "Retype your Password" cpassword_message = "Retype your Password" +cpassword_default = "Re-enter Password" email_tag = "Email Address" email_tooltip = "Email Address to which a confirmation email will be sent." email_message = "Please verify that the e-mail address you enter here is valid and will remain valid in the future. It will only be used to manage your Ryzom Core account." +email_default = "Email" -tac_tag = "YES, I agree to the terms of service." +tac_tag = "YES, I agree to the terms of service." tac_message = "You must accept the Terms of Service." diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/add_user.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/add_user.php index 3fb6d5fa3..0fedc2aba 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/add_user.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/add_user.php @@ -1,5 +1,4 @@ 1, 'no_visible_elements' => $no_visible_elements ); + +if ( isset($functionReturn) ){ + $return = array_merge(array( 'permission' => 1, 'no_visible_elements' => $no_visible_elements ),$functionReturn); +}else{ + $return = array( 'permission' => 1, 'no_visible_elements' => $no_visible_elements ); +} +//print_r($return); helpers :: loadTemplate( $page , $return ); diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/register.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/register.tpl index b1fa7cbf7..33543a3bf 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/register.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/register.tpl @@ -12,63 +12,74 @@
{$welcome_message}
-
- Register Account + + {$title} -
- +
+
- +
-
- +
+
- -
-
-
-
- -
-
- - +
-
- +
+ +
+
+ + +
+
+
+ +
+
- +
-
+
{$tac_tag} +
- + +
+ + +