diff --git a/mojotrollz/api/api_mojotrollz.php b/mojotrollz/api/api_mojotrollz.php index 908e01a..9354f58 100644 --- a/mojotrollz/api/api_mojotrollz.php +++ b/mojotrollz/api/api_mojotrollz.php @@ -11,11 +11,21 @@ class api_mojotrollz extends \SYSTEM\API\api_system { \SYSTEM\LOG\JsonResult::fail(); } - public static function call_account_action_create($username, $password, $email, $wowpassword){ + public static function call_account_action_create($username, $password, $email, $wow_password){ if(!\SYSTEM\SECURITY\security::available($username,$email) || !self::wow_username_available($username)){ throw new \SYSTEM\LOG\ERROR('EMail is already in use or Username is not available.');} if( !\SYSTEM\SECURITY\security::create($username, $password, $email, \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_LANG)) || - !self::wow_account_register($username,$email,$wowpassword)){ + !self::wow_account_register($username,$email,$wow_password)){ + throw new ERROR("Account creation failed. Retry later.");} + return JsonResult::ok(); + } + + public static function call_account_action_create_wow($username, $wow_password){ + if(!\SYSTEM\SECURITY\security::isLoggedIn()){ + throw new \SYSTEM\LOG\ERROR('You need to be logged in to register another WoW Account.');} + if(!self::wow_username_available($username)){ + throw new \SYSTEM\LOG\ERROR('Username is not available.');} + if( !self::wow_account_register($username, \SYSTEM\SECURITY\security::getUser()->email,$wow_password)){ throw new ERROR("Account creation failed. Retry later.");} return JsonResult::ok(); } diff --git a/mojotrollz/page/account_tbc/account_tbc.php b/mojotrollz/page/account_tbc/account_tbc.php index c150589..a62c1ef 100644 --- a/mojotrollz/page/account_tbc/account_tbc.php +++ b/mojotrollz/page/account_tbc/account_tbc.php @@ -19,7 +19,9 @@ class account_tbc implements \SYSTEM\PAGE\Page { while($row = $res->next()){ $row['online'] = $row['online'] == 1 ? 'online' : 'offline'; $vars['wow_accounts'] .= \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_account/tpl/wow_account.tpl'))->SERVERPATH(), $row);} - $vars['wow_accounts_confirm'] = \SYSTEM\SECURITY\security::getUser()->email_confirmed ? '' : \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_account/tpl/wow_accounts_confirm.tpl'))->SERVERPATH()); + $vars['wow_accounts_confirm'] = \SYSTEM\SECURITY\security::getUser()->email_confirmed ? + \SYSTEM\PAGE\replace::replaceFile((new PPAGE('account_tbc/tpl/account_tbc_new.tpl'))->SERVERPATH()) : + \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_account/tpl/wow_accounts_confirm.tpl'))->SERVERPATH()); return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('account_tbc/tpl/account_tbc.tpl'))->SERVERPATH(), $vars); } diff --git a/mojotrollz/page/account_tbc/tpl/account_tbc_new.tpl b/mojotrollz/page/account_tbc/tpl/account_tbc_new.tpl new file mode 100644 index 0000000..403ef57 --- /dev/null +++ b/mojotrollz/page/account_tbc/tpl/account_tbc_new.tpl @@ -0,0 +1,5 @@ +
+
+

New Account

+
+
\ No newline at end of file diff --git a/mojotrollz/page/account_tbc_new/account_tbc_new.php b/mojotrollz/page/account_tbc_new/account_tbc_new.php new file mode 100644 index 0000000..1eac96d --- /dev/null +++ b/mojotrollz/page/account_tbc_new/account_tbc_new.php @@ -0,0 +1,19 @@ +SERVERPATH(), $vars);} + + return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('account_tbc_new/tpl/account_tbc_new.tpl'))->SERVERPATH(), $vars); + } + + public static function css() {return array();} +} \ No newline at end of file diff --git a/mojotrollz/page/account_tbc_new/autoload.inc b/mojotrollz/page/account_tbc_new/autoload.inc new file mode 100644 index 0000000..a05a7ef --- /dev/null +++ b/mojotrollz/page/account_tbc_new/autoload.inc @@ -0,0 +1,3 @@ +"); + location.reload(true); + } else { + $('.help-block').html("Login not successfull.
User & Password combination wrong."); + } + }); + event.preventDefault(); + } + }); + + $("#register_tbc_form input").not("[type=submit]").jqBootstrapValidation({ + preventSubmit: true, + submitError: function (form, event, errors) {}, + submitSuccess: function($form, event){ + var username = $('#register_username').val(); + var password = $('#user_register_password2').val(); + $.ajax({ + dataType: "json", + url: './api.php', + data: { + call: 'account', + action: 'create_wow', + username: username, + wow_password: $.sha1(username.toUpperCase()+':'+password.toUpperCase()), + }, + success: function (data) { + if(data.status){ // reload -> user will be loged in + $('#help_block_tbc_register').html('Account registered!'); + }else{ // show errors + $('#help_block_tbc_register').html(data.result.message); + } + } + }); + event.preventDefault(); + } + }); +} \ No newline at end of file diff --git a/mojotrollz/page/account_tbc_new/tpl/account_tbc_new.tpl b/mojotrollz/page/account_tbc_new/tpl/account_tbc_new.tpl new file mode 100644 index 0000000..e3690d2 --- /dev/null +++ b/mojotrollz/page/account_tbc_new/tpl/account_tbc_new.tpl @@ -0,0 +1,78 @@ +
+

Register a new TBC Account

+
+
+
+
+
+ + + + + + + + + + + + + + + +
${basic_username} +
+ +
+
+
${basic_password} +
+
+ +
+
+
+ +
+
+
+
+

Back to TBC-Accounts

+
+

+ +

+
+

+
+
+
+
+

Create another WoW TBC Account for your Website Account.

+

Website-Accounts

+

TBC-Accounts

+
+
+
+
\ No newline at end of file diff --git a/mojotrollz/page/autoload.inc b/mojotrollz/page/autoload.inc index 504d0be..33af770 100644 --- a/mojotrollz/page/autoload.inc +++ b/mojotrollz/page/autoload.inc @@ -12,6 +12,8 @@ require_once dirname(__FILE__).'/default_register/autoload.inc'; require_once dirname(__FILE__).'/default_resetpassword/autoload.inc'; require_once dirname(__FILE__).'/account_website/autoload.inc'; -require_once dirname(__FILE__).'/account_tbc/autoload.inc'; require_once dirname(__FILE__).'/account_changepassword/autoload.inc'; -require_once dirname(__FILE__).'/account_changeemail/autoload.inc'; \ No newline at end of file +require_once dirname(__FILE__).'/account_changeemail/autoload.inc'; + +require_once dirname(__FILE__).'/account_tbc/autoload.inc'; +require_once dirname(__FILE__).'/account_tbc_new/autoload.inc'; \ No newline at end of file diff --git a/mojotrollz/page/default_resetpassword/tpl/default_resetpassword.tpl b/mojotrollz/page/default_resetpassword/tpl/default_resetpassword.tpl index d55381d..464f93d 100644 --- a/mojotrollz/page/default_resetpassword/tpl/default_resetpassword.tpl +++ b/mojotrollz/page/default_resetpassword/tpl/default_resetpassword.tpl @@ -1,7 +1,7 @@


-
+

Mojotrollz - Reset Password

@@ -18,7 +18,7 @@
-

Register an Account

+

Login or Register an Account

diff --git a/mojotrollz/page/page_mojotrollz.php b/mojotrollz/page/page_mojotrollz.php index 59035f1..05819b2 100644 --- a/mojotrollz/page/page_mojotrollz.php +++ b/mojotrollz/page/page_mojotrollz.php @@ -39,13 +39,16 @@ class page_mojotrollz extends \SYSTEM\API\api_default { public static function page_account_website(){ return (new account_website())->html();} - - public static function page_account_tbc(){ - return (new account_tbc())->html();} public static function page_account_changepassword(){ return (new account_changepassword())->html();} public static function page_account_changeemail(){ return (new account_changeemail())->html();} + + public static function page_account_tbc(){ + return (new account_tbc())->html();} + + public static function page_account_tbc_new(){ + return (new account_tbc_new())->html();} } \ No newline at end of file diff --git a/mojotrollz/sql/mysql/system_api.sql b/mojotrollz/sql/mysql/system_api.sql index 5bc04a3..17e3cf9 100644 --- a/mojotrollz/sql/mysql/system_api.sql +++ b/mojotrollz/sql/mysql/system_api.sql @@ -3,11 +3,14 @@ REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `na REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (200, 0, 2, 11, 'newserver', 'address', 'STRING'); REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (205, 0, 2, 11, 'vote', 'server', 'INT'); -REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (210, 0, 2, 11, 'register', 'username', 'STRING'); -REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (211, 0, 2, 11, 'register', 'password', 'STRING'); -REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (212, 0, 2, 11, 'register', 'email', 'STRING'); -REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (213, 0, 2, 11, 'register', 'wowpassword', 'STRING'); -REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (214, 0, 3, 11, 'register', 'betakey', 'STRING'); +-- REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (210, 0, 2, 11, 'register', 'username', 'STRING'); +-- REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (211, 0, 2, 11, 'register', 'password_sha1', 'STRING'); +-- REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (212, 0, 2, 11, 'register', 'email', 'STRING'); +-- REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (213, 0, 2, 11, 'register', 'wow_password', 'STRING'); +-- REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (214, 0, 3, 11, 'register', 'betakey', 'STRING'); + +REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (210, 0, 2, 11, 'create_wow', 'username', 'STRING'); +REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (211, 0, 2, 11, 'create_wow', 'wow_password', 'STRING'); -- REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (210, 1, 3, 1, 'beta', 'key', 'STRING'); REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (215, 1, 2, 1, 'article', 'id', 'STRING'); diff --git a/mojotrollz/sql/mysql/system_page.sql b/mojotrollz/sql/mysql/system_page.sql index fc07a21..8f70c2b 100644 --- a/mojotrollz/sql/mysql/system_page.sql +++ b/mojotrollz/sql/mysql/system_page.sql @@ -9,12 +9,14 @@ REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login` REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (20, 1, 'account', 'account', -1, 0, 0, '#content', './?page=account', 'init_account', 'default_account'); REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (21, 1, 'website', 'account', 20, 1, 0, '#content_account', './?page=account_website', 'init_account_website', 'account_website'); -REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (22, 1, 'tbc', 'account', 20, 1, 1, '#content_account', './?page=account_tbc', 'init_account_tbc', 'account_tbc'); -REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (23, 1, 'changepassword', 'account', 20, 1, 1, '#content_account', './?page=account_changepassword', 'init_account_changepassword', 'account_changepassword'); -REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (24, 1, 'changeemail', 'account', 20, 1, 1, '#content_account', './?page=account_changeemail', 'init_account_changeemail', 'account_changeemail'); +REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (22, 1, 'changepassword', 'account', 20, 1, 1, '#content_account', './?page=account_changepassword', 'init_account_changepassword', 'account_changepassword'); +REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (23, 1, 'changeemail', 'account', 20, 1, 1, '#content_account', './?page=account_changeemail', 'init_account_changeemail', 'account_changeemail'); -REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (25, 1, 'beta', 'beta', -1, 0, 0, '#content', './?page=beta', 'init_beta', 'default_beta'); -REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (26, 1, 'register', 'register', -1, 0, 0, '#content', './?page=register', 'init_register', 'default_register'); +REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (24, 1, 'tbc', 'account', 20, 1, 1, '#content_account', './?page=account_tbc', 'init_account_tbc', 'account_tbc'); +REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (25, 1, 'tbc_new', 'account', 20, 1, 1, '#content_account', './?page=account_tbc_new', 'init_account_tbc_new', 'account_tbc_new'); + +REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (26, 1, 'beta', 'beta', -1, 0, 0, '#content', './?page=beta', 'init_beta', 'default_beta'); +REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (27, 1, 'register', 'register', -1, 0, 0, '#content', './?page=register', 'init_register', 'default_register'); REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (30, 1, 'article', 'article', -1, 0, 0, '#content', './?page=article&id=${article}', 'init_article', 'default_article');