From 1c4bb138e92044a36e11b3d60f2a0921808522ff Mon Sep 17 00:00:00 2001 From: Quitta Date: Mon, 17 Jun 2013 16:29:20 +0200 Subject: [PATCH 1/4] Select automatically if it should load with no_visible_elements on or off + minor updates --HG-- branch : quitta-gsoc-2013 --- code/ryzom/tools/server/ryzom_ams/www/html/index.php | 10 +++++++--- code/ryzom/tools/server/ryzom_ams/www/html/js/help.js | 6 +++--- .../tools/server/ryzom_ams/www/html/templates/home.tpl | 6 ++---- .../server/ryzom_ams/www/html/templates/layout.tpl | 1 - 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/index.php b/code/ryzom/tools/server/ryzom_ams/www/html/index.php index e925bb92c..e4e265903 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/index.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/index.php @@ -12,12 +12,16 @@ function loadpage ( $page ){ require_once( 'autoload/' . $page . '.php' ); } -$page = 'home'; +$page = 'login'; if ( isset( $_GET["page"] ) ){ $page = $_GET["page"]; } -// temporary set permission to 1 which = admin mode -$return = array( 'permission' => 1, 'no_visible_elements' => 'FALSE' ); +//Page Handling +if($page == 'login' || $page == 'register'){ + $no_visible_elements = 'TRUE'; +} +// temporary set permission to 2 which = admin mode +$return = array( 'permission' => 1, 'no_visible_elements' => $no_visible_elements ); helpers :: loadTemplate( $page , $return ); diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/js/help.js b/code/ryzom/tools/server/ryzom_ams/www/html/js/help.js index 519454ef6..60a9980aa 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/js/help.js +++ b/code/ryzom/tools/server/ryzom_ams/www/html/js/help.js @@ -1,13 +1,13 @@ function show_help(help_tip) { - if(help_tip =='test') + if(help_tip =='intro') { var tour = new Tour(); tour.addStep({ element: ".brand:first", /* html element next to which the step popover should be shown */ placement: "bottom", - title: "Custom Tour", /* title of the popover */ - content: "You can create tour like this. Click Next." /* content of the popover */ + title: "Account Management System", /* title of the popover */ + content: "Welcome to the Ryzom Core Account Management System! Let's explore it together... Click next!" /* content of the popover */ }); tour.addStep({ element: ".theme-container", diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/home.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/home.tpl index f517f60c4..fb14ba5ba 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/home.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/home.tpl @@ -36,16 +36,14 @@

Introduction

- +
-

Charisma free, premium quality, responsive, multiple skin admin template.

-

Its a live demo of the template. I have created Charisma to ease the repeat work I have to do on my projects. Now I re-use Charisma as a base for my admin panel work and I am sharing it with you :)

-

All pages in the menu are functional, take a look at all, please share this with your followers.

+

Welcome to the Ryzom Core - Account Management System

diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl index 90902b2f5..95432a22b 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl @@ -88,7 +88,6 @@ -
From 79e7b18bc8158b64c5293066ef59700b456d33b7 Mon Sep 17 00:00:00 2001 From: Quitta Date: Mon, 17 Jun 2013 21:42:33 +0200 Subject: [PATCH 2/4] Changed register form + tried getting messages passed --HG-- branch : quitta-gsoc-2013 --- .../ryzom_ams/ams_lib/autoload/users.php | 6 +- .../ryzom_ams/ams_lib/translations/en.ini | 13 +- .../ryzom_ams/www/html/inc/add_user.php | 6 +- .../ryzom_ams/www/html/templates/layout.tpl | 2 + .../ryzom_ams/www/html/templates/register.tpl | 166 +++++++----------- 5 files changed, 76 insertions(+), 117 deletions(-) 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 ffac7bc8d..33873f0b7 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 @@ -27,13 +27,13 @@ class Users{ 'status' => 1, 'access' => REQUEST_TIME ); - user_save( NULL, $edit ); + //user_save( NULL, $edit ); header( 'Location: email_sent.php' ); exit; }else{ $pageElements = array( - 'GAME_NAME' => variable_get( 'ryzommanage_game-name', '' ), - 'WELCOME_MESSAGE' => variable_get( 'ryzommanage_register-welcome', '' ), + //'GAME_NAME' => variable_get( 'ryzommanage_game-name', '' ), + //'WELCOME_MESSAGE' => variable_get( 'ryzommanage_register-welcome', '' ), 'USERNAME' => $user, 'PASSWORD' => $pass, 'CPASSWORD' => $cpass, 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 e25bfd88b..e8291b26b 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 @@ -7,18 +7,21 @@ [register] title = "RYZOM CORE INGAME REGISTRATION" -welcome_message = "Welcome! Please fill in the following fields to get your new Ryzom Core account:" +welcome_message = "Welcome! Please fill in the following fields to get your new Ryzom Core account" -username_tag = "Desired Username:" +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." -password_tag = "Desired Password:" +password_tag = "Desired Password" +password_tooltip = "Pick a hard to guess password (5-20 characters)." password_message = "Password must be 5-20 characters." -cpassword_tag = "Confirm Password:" +cpassword_tag = "Confirm Password" +cpassword_tooltip = "Retype your Password" cpassword_message = "Retype your Password" -email_tag = "Email Address (to which a confirmation email will be sent):" +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." tac_tag = "YES, I agree to 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 41284659e..3fb6d5fa3 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,8 +1,10 @@ {/if} 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 8649a7dc6..b1fa7cbf7 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,119 +12,71 @@
{$welcome_message}
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{$username_tag} - - {if isset($Username)}{$Username}{/if}
{$password_tag} - - {if isset($PASSWORD_ERROR) && $PASSWORD_ERROR eq "TRUE"}{$Password}{/if}
{$cpassword_tag} - {if isset($CPASSWORD_ERROR) && $CPASSWORD_ERROR eq "TRUE"}{$ConfirmPass}{/if}
{$email_tag} - - {if isset($EMAIL_ERROR) && $EMAIL_ERROR eq "TRUE"}{$Email}{/if}
{$tac_tag}
{$tac_message}
- -
- -
- -
- -
- -
-
- {$username_tooltip} -
-
- -
-
- {$password_message} +
+ Register Account + +
+ +
+
+ + +
+
-
-
-
- {$cpassword_message} -
-
-
-
- {$email_message} +
+ +
+
+ + +
+
-
+
+ +
+
+ + +
+
+
+ +
+ +
+
+ + +
+
+
+ +
+
+
+ {$tac_tag} +
+
+
+ +
+ +
+ + +
+ +
+ +
{/block} + + From 8ee559e6627c8c4809aa3c994ee144f34b5b09fc Mon Sep 17 00:00:00 2001 From: Quitta Date: Tue, 18 Jun 2013 07:22:24 +0200 Subject: [PATCH 3/4] Damn its early in the morning :D Oh well! Register works with a callback function. shows which fields are correctly filled in and which not yet. It runs quite smooth. Off to bed now! --HG-- branch : quitta-gsoc-2013 --- .../ryzom_ams/ams_lib/autoload/users.php | 95 ++++++++++--------- .../ryzom_ams/ams_lib/translations/en.ini | 6 +- .../ryzom_ams/www/html/inc/add_user.php | 1 - .../tools/server/ryzom_ams/www/html/index.php | 20 +++- .../ryzom_ams/www/html/templates/register.tpl | 55 ++++++----- 5 files changed, 102 insertions(+), 75 deletions(-) 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} +
- + +
+ + +
From 61c9a3d9a61016145ff7af2204041b5897ce9233 Mon Sep 17 00:00:00 2001 From: Quitta Date: Tue, 18 Jun 2013 16:27:57 +0200 Subject: [PATCH 4/4] show error message + tooltips while registering --HG-- branch : quitta-gsoc-2013 --- .../ryzom_ams/ams_lib/translations/en.ini | 2 +- .../ryzom_ams/www/html/templates/register.tpl | 44 +++++++++++++++++-- 2 files changed, 41 insertions(+), 5 deletions(-) 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 a1ad8d461..af9f29d05 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 @@ -14,7 +14,7 @@ username_tooltip = "5-12 lower-case characters and numbers. The login (username) username_default = "Username" password_tag = "Desired Password" -password_tooltip = "Pick a hard to guess password (5-20 characters)." +password_tooltip = "Pick a hard to guess password (it must be 5-20 characters)." password_message = "Password must be 5-20 characters." password_default = "Password" 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 33543a3bf..2ebdd67a9 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 @@ -21,7 +21,7 @@
- +
@@ -33,7 +33,7 @@
- +
@@ -44,7 +44,7 @@
- +
@@ -55,7 +55,7 @@
- +
@@ -69,6 +69,42 @@
+ + {if isset($USERNAME_ERROR) and $USERNAME_ERROR eq "TRUE"} +
+ + Username Error {$USERNAME} +
+ {/if} + + {if isset($PASSWORD_ERROR) and $PASSWORD_ERROR eq "TRUE"} +
+ + Password Error {$PASSWORD} +
+ {/if} + + {if isset($CPASSWORD_ERROR) and $CPASSWORD_ERROR eq "TRUE"} +
+ + Confirmation Password Error {$CPASSWORD} +
+ {/if} + + {if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE"} +
+ + Email Error {$EMAIL} +
+ {/if} + + {if isset($TAC_ERROR) and $TAC_ERROR eq "TRUE"} +
+ + Terms of Service Error {$tac_message} +
+ {/if} +