#124 change website password, change email started (does not effect wow accounts yet)
This commit is contained in:
parent
045e19d44b
commit
d20d7cec32
@ -21,6 +21,21 @@ class api_mojotrollz extends \SYSTEM\API\api_system {
|
||||
|
||||
return JsonResult::ok();
|
||||
}
|
||||
|
||||
public static function call_account_action_changepassword($old_password_sha1, $new_password_sha1){
|
||||
if(!\SYSTEM\SECURITY\security::isLoggedIn()){
|
||||
throw new ERROR("You need to be logged in to change your Password!");}
|
||||
|
||||
return self::call_account_action_change_password(\SYSTEM\SECURITY\security::getUser()->username, $old_password_sha1, $new_password_sha1);
|
||||
}
|
||||
|
||||
public static function call_account_action_changeemail($new_email){
|
||||
if(!\SYSTEM\SECURITY\security::isLoggedIn()){
|
||||
throw new ERROR("You need to be logged in to change your EMail!");}
|
||||
|
||||
return self::call_account_action_change_email(\SYSTEM\SECURITY\security::getUser()->username, $new_email);
|
||||
}
|
||||
|
||||
//prevent normal register
|
||||
//public static function call_account_action_create($username, $password_sha, $email, $locale){
|
||||
// return JsonResult::fail();}
|
||||
|
||||
19
mojotrollz/page/account_changeemail/account_changeemail.php
Normal file
19
mojotrollz/page/account_changeemail/account_changeemail.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
class account_changeemail implements \SYSTEM\PAGE\Page {
|
||||
public static function title(){
|
||||
return \SYSTEM\PAGE\text::get('title_account');}
|
||||
public static function meta(){
|
||||
return \SYSTEM\PAGE\text::tag('meta_account');}
|
||||
public static function js(){
|
||||
return array(new \PPAGE('account_changeemail/js/account_changeemail.js'));}
|
||||
public function html(){
|
||||
$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('account_changeemail/tpl/account_changeemail.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
public static function css() {return array();}
|
||||
}
|
||||
2
mojotrollz/page/account_changeemail/autoload.inc
Normal file
2
mojotrollz/page/account_changeemail/autoload.inc
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__));
|
||||
@ -0,0 +1,28 @@
|
||||
function init_account_changeemail(){
|
||||
$("#account_menu li").removeClass("active");
|
||||
$('#li_account').addClass('active');
|
||||
|
||||
$("#changeemail_user_form input").not("[type=submit]").jqBootstrapValidation({
|
||||
preventSubmit: true,
|
||||
submitError: function (form, event, errors) {},
|
||||
submitSuccess: function($form, event){
|
||||
$.ajax({
|
||||
dataType: "json",
|
||||
url: './api.php',
|
||||
data: {
|
||||
call: 'account',
|
||||
action: 'changeemail',
|
||||
new_email: $('#user_email_new').val(),
|
||||
},
|
||||
success: function (data) {
|
||||
if(data.status){ // reload -> user will be loged in
|
||||
$('#changeemail-help-block').html('EMail sent!');
|
||||
}else{ // show errors
|
||||
$('#changeemail-help-block').html(data.result ? data.result.message : 'Sending EMail failed!');
|
||||
}
|
||||
}
|
||||
});
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h4>Change Account EMail</h4></div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<form class="textbox" style="padding:10px" id="changeemail_user_form">
|
||||
<div class="control-group">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>${basic_email_new}</th>
|
||||
<td style="vertical-align: top; padding-top: 17px;">
|
||||
<div class="control-group controls">
|
||||
<input type="email"
|
||||
size="35"
|
||||
style="margin-bottom: 15px; float: left;"
|
||||
id="user_email_new"
|
||||
placeholder="${basic_placeholder_email}"
|
||||
data-validation-email-message="${basic_email_wrong}"
|
||||
required data-validation-required-message="${basic_email_miss}"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<p style="float: left;"><a href="#!account">Back to Website Account</a></p>
|
||||
</th>
|
||||
<td>
|
||||
<p style="float: right;">
|
||||
<button class="btn-sm btn btn-success" style="clear: left; height: 32px; font-size: 13px;" type="submit" id="emailchange_submit"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> ${basic_change_email}</button>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p class="help-block" id="changeemail-help-block" style="float: left; margin-top: 3px;"></p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-4" style="padding-top: 10px;">
|
||||
<p>This function sends an EMail to your old Email-Address with a link to confirm the EMail-Change.</p>
|
||||
<p>The EMail-Change effects the Website Account and all WoW-Accounts.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
class account_changepassword implements \SYSTEM\PAGE\Page {
|
||||
public static function title(){
|
||||
return \SYSTEM\PAGE\text::get('title_account');}
|
||||
public static function meta(){
|
||||
return \SYSTEM\PAGE\text::tag('meta_account');}
|
||||
public static function js(){
|
||||
return array(new \PPAGE('account_changepassword/js/account_changepassword.js'));}
|
||||
public function html(){
|
||||
$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('account_changepassword/tpl/account_changepassword.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
public static function css() {return array();}
|
||||
}
|
||||
2
mojotrollz/page/account_changepassword/autoload.inc
Normal file
2
mojotrollz/page/account_changepassword/autoload.inc
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__));
|
||||
@ -0,0 +1,31 @@
|
||||
function init_account_changepassword(){
|
||||
$("#account_menu li").removeClass("active");
|
||||
$('#li_account').addClass('active');
|
||||
|
||||
$("#changepassword_user_form input").not("[type=submit]").jqBootstrapValidation({
|
||||
preventSubmit: true,
|
||||
submitError: function (form, event, errors) {},
|
||||
submitSuccess: function($form, event){
|
||||
var password_old = $('#user_password_old').val();
|
||||
var password_new = $('#user_password_new2').val();
|
||||
$.ajax({
|
||||
dataType: "json",
|
||||
url: './api.php',
|
||||
data: {
|
||||
call: 'account',
|
||||
action: 'changepassword',
|
||||
old_password_sha1: $.sha1(password_old),
|
||||
new_password_sha1: $.sha1(password_new),
|
||||
},
|
||||
success: function (data) {
|
||||
if(data.status){ // reload -> user will be loged in
|
||||
$('#changepassword-help-block').html('Changed Password!');
|
||||
}else{ // show errors
|
||||
$('#changepassword-help-block').html(data.result ? data.result.message : 'Password change failed!');
|
||||
}
|
||||
}
|
||||
});
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h4>Change Website Account Password</h4></div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<form class="textbox" style="padding:10px" id="changepassword_user_form">
|
||||
<div class="control-group">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>${basic_password_old}</th>
|
||||
<td style="vertical-align: top; padding-top: 17px;">
|
||||
<div class="control-group controls">
|
||||
<input type="password"
|
||||
size="35"
|
||||
style="margin-bottom: 15px;"
|
||||
id="user_password_old"
|
||||
placeholder="${basic_placeholder_password}"
|
||||
minlength="5" data-validation-minlength-message="${basic_password_short}"
|
||||
maxlength="16" data-validation-maxlength-message="${basic_password_long}"
|
||||
required data-validation-required-message="${basic_password_miss}"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><hr></th>
|
||||
<th><hr></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="vertical-align: top; padding-top: 20px;">${basic_password_new}</th>
|
||||
<td>
|
||||
<div class="control-group" id="change_user_password">
|
||||
<div class="control-group controls" style="clear: both">
|
||||
<input type="password"
|
||||
size="35"
|
||||
style="margin-bottom: 15px; float: left;"
|
||||
id="user_password_new1"
|
||||
name="user_password_new1"
|
||||
placeholder="${basic_placeholder_password}"
|
||||
minlength="5"
|
||||
data-validation-minlength-message="${basic_password_short}"
|
||||
required data-validation-required-message="${basic_password_miss}"/>
|
||||
</div>
|
||||
<div class="control-group controls" style="clear: both">
|
||||
<input type="password"
|
||||
size="35"
|
||||
style="margin-bottom: 15px; float: left;"
|
||||
id="user_password_new2"
|
||||
name="user_password_new2"
|
||||
placeholder="${basic_placeholder_password}"
|
||||
data-validation-matches-match="user_password_new1"
|
||||
data-validation-matches-message="${basic_password_match}"/>
|
||||
<br/>
|
||||
</div>
|
||||
<p class="help-block" id="changepassword-help-block" style="float: left; margin-top: 3px;"></p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<p style="float: left;"><a href="#!account">Back to Website Account</a></p>
|
||||
</th>
|
||||
<td>
|
||||
<p style="float: right;">
|
||||
<button class="btn-sm btn btn-success" style="clear: left; height: 32px; font-size: 13px;" type="submit" id="login_submit"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> ${basic_change_password}</button>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-4" style="padding-top: 10px;">
|
||||
<p>Caution! This function does not change your WoW-Account's Password.</p>
|
||||
<p>To change your WoW-Accounts Password's visit your <a href="#!account(tbc)">WoW-Accounts</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,8 +1,10 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h4>Account</h4></div>
|
||||
<div class="panel-body">
|
||||
You are logged in as <b>${email}</b><br>
|
||||
Your Website Account-Name is: <b>${username}</b><br>
|
||||
<p>You are logged in as <b>${email}</b></p>
|
||||
<p>Your Website Account-Name is: <b>${username}</b></p>
|
||||
<p><a href="#!account(changepassword)">Change Password</a></p>
|
||||
<p><a href="#!account(changeemail)">Change EMail</a></p>
|
||||
${option_confirm_email}
|
||||
</div>
|
||||
</div>
|
||||
@ -1,2 +1,2 @@
|
||||
<a href="#!account" user="${username}" id="link_confirm_email">Request EMail Confirmation</a>
|
||||
<p><a href="#!account" user="${username}" id="link_confirm_email">Request EMail Confirmation</a></p>
|
||||
<p style="display:none; padding-top: 10px;" id="notice_email_confirm"></p>
|
||||
@ -11,4 +11,6 @@ require_once dirname(__FILE__).'/default_donate/autoload.inc';
|
||||
require_once dirname(__FILE__).'/default_register/autoload.inc';
|
||||
|
||||
require_once dirname(__FILE__).'/account_website/autoload.inc';
|
||||
require_once dirname(__FILE__).'/account_tbc/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';
|
||||
@ -17,9 +17,9 @@
|
||||
style="margin-bottom: 15px;"
|
||||
id="bt_login_user"
|
||||
placeholder="${basic_placeholder_username}"
|
||||
minlength="3" data-validation-minlength-message="${sai_error_username_short}"
|
||||
maxlength="16" data-validation-maxlength-message="${sai_error_username_long}"
|
||||
required data-validation-required-message="${sai_error_username_miss}"/>
|
||||
minlength="3" data-validation-minlength-message="${basic_username_short}"
|
||||
maxlength="16" data-validation-maxlength-message="${basic_username_long}"
|
||||
required data-validation-required-message="${basic_username_miss}"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -32,9 +32,9 @@
|
||||
style="margin-bottom: 15px;"
|
||||
id="bt_login_password"
|
||||
placeholder="${basic_placeholder_password}"
|
||||
minlength="5" data-validation-minlength-message="${sai_error_password_short}"
|
||||
maxlength="16" data-validation-maxlength-message="${sai_error_password_long}"
|
||||
required data-validation-required-message="${sai_error_password_miss}"/>
|
||||
minlength="5" data-validation-minlength-message="${basic_password_short}"
|
||||
maxlength="16" data-validation-maxlength-message="${basic_password_long}"
|
||||
required data-validation-required-message="${basic_password_miss}"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<div class="row-fluid">
|
||||
<div class="col-md-12">
|
||||
<p style="font-size: 12px; padding-top: 15px;">To see all your Accounts confirm Your Email!</p>
|
||||
<p style="font-size: 12px; padding-top: 15px;">To see all your Accounts <a href="#!account">confirm Your Email</a>!</p>
|
||||
</div>
|
||||
</div>
|
||||
@ -4,28 +4,28 @@ function init_register(){
|
||||
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',
|
||||
username: username,
|
||||
password_sha1: $.sha1(password),
|
||||
email: $('#register_email').val(),
|
||||
wow_password: $.sha1(username.toUpperCase()+':'+password.toUpperCase()),
|
||||
},
|
||||
success: function (data) {
|
||||
if(data.status){ // reload -> user will be loged in
|
||||
system.load('beta');
|
||||
}else{ // show errors
|
||||
$('.help-block').html(data.result.message);
|
||||
}
|
||||
var username = $('#register_username').val();
|
||||
var password = $('#user_register_password2').val();
|
||||
$.ajax({
|
||||
dataType: "json",
|
||||
url: './api.php',
|
||||
data: {
|
||||
call: 'account',
|
||||
action: 'create',
|
||||
username: username,
|
||||
password_sha1: $.sha1(password),
|
||||
email: $('#register_email').val(),
|
||||
wow_password: $.sha1(username.toUpperCase()+':'+password.toUpperCase()),
|
||||
},
|
||||
success: function (data) {
|
||||
if(data.status){ // reload -> user will be loged in
|
||||
system.load('beta');
|
||||
}else{ // show errors
|
||||
$('.help-block').html(data.result.message);
|
||||
}
|
||||
});
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -39,4 +39,10 @@ class page_mojotrollz extends \SYSTEM\API\api_default {
|
||||
|
||||
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();}
|
||||
}
|
||||
@ -12,6 +12,10 @@ REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `na
|
||||
-- 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');
|
||||
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (220, 0, 2, 11, 'changepassword', 'old_password_sha1', 'STRING');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (221, 0, 2, 11, 'changepassword', 'new_password_sha1', 'STRING');
|
||||
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (222, 0, 2, 11, 'changeemail', 'new_email', 'EMAIL');
|
||||
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (500, 0, 2, 11, 'item', 'id', 'INT');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (501, 0, 2, 11, 'itemextendedcost', 'id', 'INT');
|
||||
@ -8,6 +8,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 (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 (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');
|
||||
|
||||
@ -29,6 +29,11 @@ REPLACE INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_password_short', 'mo
|
||||
REPLACE INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_password_long', 'mojotrollz');
|
||||
REPLACE INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_password_miss', 'mojotrollz');
|
||||
REPLACE INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_password_match', 'mojotrollz');
|
||||
REPLACE INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_password_new', 'mojotrollz');
|
||||
REPLACE INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_password_old', 'mojotrollz');
|
||||
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` (`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');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user