From 848e10d052664154271de13d6b8776ea08506b62 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Dec 2016 01:26:06 +0100 Subject: [PATCH] #124 reset password --- lib/system | 2 +- .../account_changeemail.php | 2 +- .../account_changepassword.php | 2 +- .../tpl/account_changepassword.tpl | 5 +- .../page/account_login/tpl/account_login.tpl | 58 ------------------- mojotrollz/page/account_tbc/account_tbc.php | 2 +- .../page/account_website/account_website.php | 2 +- mojotrollz/page/autoload.inc | 1 + .../page/default_account/default_account.php | 2 +- .../tpl/{loggedout.tpl => account_login.tpl} | 26 +++++---- .../page/default_resetpassword/autoload.inc | 2 + .../default_resetpassword.php | 14 +++++ .../js/default_resetpassword.js | 11 ++++ .../tpl/default_resetpassword.tpl | 35 +++++++++++ mojotrollz/page/page_mojotrollz.php | 3 + mojotrollz/sql/mysql/system_page.sql | 2 + mojotrollz/sql/mysql/system_text.sql | 1 + 17 files changed, 94 insertions(+), 76 deletions(-) delete mode 100644 mojotrollz/page/account_login/tpl/account_login.tpl rename mojotrollz/page/default_account/tpl/{loggedout.tpl => account_login.tpl} (77%) create mode 100644 mojotrollz/page/default_resetpassword/autoload.inc create mode 100644 mojotrollz/page/default_resetpassword/default_resetpassword.php create mode 100644 mojotrollz/page/default_resetpassword/js/default_resetpassword.js create mode 100644 mojotrollz/page/default_resetpassword/tpl/default_resetpassword.tpl diff --git a/lib/system b/lib/system index 209a86b..87a59c5 160000 --- a/lib/system +++ b/lib/system @@ -1 +1 @@ -Subproject commit 209a86b080deed9247de01acc5012b5df87d9b93 +Subproject commit 87a59c5e91d6d5918450444909aacdfa1d4236d2 diff --git a/mojotrollz/page/account_changeemail/account_changeemail.php b/mojotrollz/page/account_changeemail/account_changeemail.php index cca7bf6..af85c93 100644 --- a/mojotrollz/page/account_changeemail/account_changeemail.php +++ b/mojotrollz/page/account_changeemail/account_changeemail.php @@ -10,7 +10,7 @@ class account_changeemail implements \SYSTEM\PAGE\Page { $vars = \SYSTEM\PAGE\text::tag('mojotrollz'); if(!\SYSTEM\SECURITY\security::isLoggedIn()){ - return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('account_login/tpl/account_login.tpl'))->SERVERPATH(), $vars);} + return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_account/tpl/account_login.tpl'))->SERVERPATH(), $vars);} return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('account_changeemail/tpl/account_changeemail.tpl'))->SERVERPATH(), $vars); } diff --git a/mojotrollz/page/account_changepassword/account_changepassword.php b/mojotrollz/page/account_changepassword/account_changepassword.php index 139196f..7534503 100644 --- a/mojotrollz/page/account_changepassword/account_changepassword.php +++ b/mojotrollz/page/account_changepassword/account_changepassword.php @@ -10,7 +10,7 @@ class account_changepassword implements \SYSTEM\PAGE\Page { $vars = \SYSTEM\PAGE\text::tag('mojotrollz'); if(!\SYSTEM\SECURITY\security::isLoggedIn()){ - return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('account_login/tpl/account_login.tpl'))->SERVERPATH(), $vars);} + return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_account/tpl/account_login.tpl'))->SERVERPATH(), $vars);} return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('account_changepassword/tpl/account_changepassword.tpl'))->SERVERPATH(), $vars); } diff --git a/mojotrollz/page/account_changepassword/tpl/account_changepassword.tpl b/mojotrollz/page/account_changepassword/tpl/account_changepassword.tpl index 8cceaf4..83b1ffa 100644 --- a/mojotrollz/page/account_changepassword/tpl/account_changepassword.tpl +++ b/mojotrollz/page/account_changepassword/tpl/account_changepassword.tpl @@ -49,10 +49,10 @@ name="user_password_new2" placeholder="${basic_placeholder_password}" data-validation-matches-match="user_password_new1" - data-validation-matches-message="${basic_password_match}"/> + required data-validation-matches-message="${basic_password_match}"/>
-

+

@@ -68,6 +68,7 @@ +

diff --git a/mojotrollz/page/account_login/tpl/account_login.tpl b/mojotrollz/page/account_login/tpl/account_login.tpl deleted file mode 100644 index 996c65b..0000000 --- a/mojotrollz/page/account_login/tpl/account_login.tpl +++ /dev/null @@ -1,58 +0,0 @@ -
-
-
-

Mojotrollz - Login

-
-
-
- - - - - - - - - - - - - - - -
${basic_username} -
- -
-
${basic_password} -
- -
-
-

Register an Account

-
-

- -

-
-

-
-
-
-
-
-
\ No newline at end of file diff --git a/mojotrollz/page/account_tbc/account_tbc.php b/mojotrollz/page/account_tbc/account_tbc.php index 11e36e8..c150589 100644 --- a/mojotrollz/page/account_tbc/account_tbc.php +++ b/mojotrollz/page/account_tbc/account_tbc.php @@ -10,7 +10,7 @@ class account_tbc implements \SYSTEM\PAGE\Page { $vars = \SYSTEM\PAGE\text::tag('mojotrollz'); if(!\SYSTEM\SECURITY\security::isLoggedIn()){ - return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('account_login/tpl/account_login.tpl'))->SERVERPATH(), $vars);} + return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_account/tpl/account_login.tpl'))->SERVERPATH(), $vars);} $vars['email'] = \SYSTEM\SECURITY\security::getUser()->email; $vars['username'] = \SYSTEM\SECURITY\security::getUser()->username; diff --git a/mojotrollz/page/account_website/account_website.php b/mojotrollz/page/account_website/account_website.php index 4a75e95..2f29a0f 100644 --- a/mojotrollz/page/account_website/account_website.php +++ b/mojotrollz/page/account_website/account_website.php @@ -10,7 +10,7 @@ class account_website implements \SYSTEM\PAGE\Page { $vars = \SYSTEM\PAGE\text::tag('mojotrollz'); if(!\SYSTEM\SECURITY\security::isLoggedIn()){ - return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('account_login/tpl/account_login.tpl'))->SERVERPATH(), $vars);} + return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_account/tpl/account_login.tpl'))->SERVERPATH(), $vars);} $vars['email'] = \SYSTEM\SECURITY\security::getUser()->email; $vars['username'] = \SYSTEM\SECURITY\security::getUser()->username; diff --git a/mojotrollz/page/autoload.inc b/mojotrollz/page/autoload.inc index 237adc4..504d0be 100644 --- a/mojotrollz/page/autoload.inc +++ b/mojotrollz/page/autoload.inc @@ -9,6 +9,7 @@ require_once dirname(__FILE__).'/default_beta/autoload.inc'; require_once dirname(__FILE__).'/default_article/autoload.inc'; require_once dirname(__FILE__).'/default_donate/autoload.inc'; 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'; diff --git a/mojotrollz/page/default_account/default_account.php b/mojotrollz/page/default_account/default_account.php index 9f42fc3..927b7f7 100644 --- a/mojotrollz/page/default_account/default_account.php +++ b/mojotrollz/page/default_account/default_account.php @@ -9,7 +9,7 @@ class default_account implements \SYSTEM\PAGE\Page { public function html(){ $vars = \SYSTEM\PAGE\text::tag('mojotrollz'); if(!\SYSTEM\SECURITY\security::isLoggedIn()){ - return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_account/tpl/loggedout.tpl'))->SERVERPATH(), $vars);} + return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_account/tpl/account_login.tpl'))->SERVERPATH(), $vars);} return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_account/tpl/loggedin.tpl'))->SERVERPATH(), $vars); } diff --git a/mojotrollz/page/default_account/tpl/loggedout.tpl b/mojotrollz/page/default_account/tpl/account_login.tpl similarity index 77% rename from mojotrollz/page/default_account/tpl/loggedout.tpl rename to mojotrollz/page/default_account/tpl/account_login.tpl index 10da0b0..bf2ed63 100644 --- a/mojotrollz/page/default_account/tpl/loggedout.tpl +++ b/mojotrollz/page/default_account/tpl/account_login.tpl @@ -3,18 +3,17 @@

Mojotrollz - Login

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

Register an Account

+

-
+

+
+

Forgot your Password?

+
-

diff --git a/mojotrollz/page/default_resetpassword/autoload.inc b/mojotrollz/page/default_resetpassword/autoload.inc new file mode 100644 index 0000000..e2c9da4 --- /dev/null +++ b/mojotrollz/page/default_resetpassword/autoload.inc @@ -0,0 +1,2 @@ +SERVERPATH(), $vars); + } +} \ No newline at end of file diff --git a/mojotrollz/page/default_resetpassword/js/default_resetpassword.js b/mojotrollz/page/default_resetpassword/js/default_resetpassword.js new file mode 100644 index 0000000..bd17050 --- /dev/null +++ b/mojotrollz/page/default_resetpassword/js/default_resetpassword.js @@ -0,0 +1,11 @@ +function init_resetpassword(){ + $('#btn_resetpassword').click(function(){ + system.account_reset_password($('#input_resetpassword').val(),function(data){ + if(data.status){ + $('.help-block').html('EMail sent.'); + } else { + $('.help-block').html(data.result.message); + } + }); + }); +} \ 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 new file mode 100644 index 0000000..d55381d --- /dev/null +++ b/mojotrollz/page/default_resetpassword/tpl/default_resetpassword.tpl @@ -0,0 +1,35 @@ +
+

+
+
+

Mojotrollz - Reset Password

+
+ + + + + + + + + + + +
${basic_username} or ${basic_email} + +
+

Register an Account

+
+

+ +

+
+

+
+
+
+
\ No newline at end of file diff --git a/mojotrollz/page/page_mojotrollz.php b/mojotrollz/page/page_mojotrollz.php index 4647214..59035f1 100644 --- a/mojotrollz/page/page_mojotrollz.php +++ b/mojotrollz/page/page_mojotrollz.php @@ -34,6 +34,9 @@ class page_mojotrollz extends \SYSTEM\API\api_default { public static function page_register(){ return (new default_register())->html();} + public static function page_resetpassword(){ + return (new default_resetpassword())->html();} + public static function page_account_website(){ return (new account_website())->html();} diff --git a/mojotrollz/sql/mysql/system_page.sql b/mojotrollz/sql/mysql/system_page.sql index 187b364..fc07a21 100644 --- a/mojotrollz/sql/mysql/system_page.sql +++ b/mojotrollz/sql/mysql/system_page.sql @@ -5,6 +5,8 @@ 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 (15, 1, 'impressum', 'impressum', -1, 0, 0, '#content', './?page=impressum', 'init_impressum', 'default_impressum'); +REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (19, 1, 'resetpassword', 'resetpassword', -1, 0, 0, '#content', './?page=resetpassword', 'init_resetpassword', 'default_resetpassword'); + 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'); diff --git a/mojotrollz/sql/mysql/system_text.sql b/mojotrollz/sql/mysql/system_text.sql index 4237627..1754c90 100644 --- a/mojotrollz/sql/mysql/system_text.sql +++ b/mojotrollz/sql/mysql/system_text.sql @@ -34,6 +34,7 @@ REPLACE INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_password_old', 'mojo REPLACE INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_change_password', 'mojotrollz'); REPLACE INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_change_email', 'mojotrollz'); REPLACE INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_email_new', 'mojotrollz'); +REPLACE INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_email', 'mojotrollz'); REPLACE INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('link_facebook', 'enUS', 'https://www.facebook.com/mojotrollz/', 10, 10, '2015-09-17 23:16:50', '2015-09-17 23:16:50'); REPLACE INTO `system_text_tag` (`id`, `tag`) VALUES ('link_facebook', 'link');