Skip to content

Commit

Permalink
Merge branch 'release/4.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlaefer committed Jun 10, 2014
2 parents 693f5c5 + 2df8894 commit f126969
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 47 deletions.
2 changes: 1 addition & 1 deletion app/Config/version.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
Configure::write('Saito.v', '4.0.1');
Configure::write('Saito.v', '4.0.2');

Configure::write('Saito.saitoHomepage', 'http://saito.siezi.com');
14 changes: 12 additions & 2 deletions app/Controller/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ public function __construct($request = null, $response = null) {
public function beforeFilter() {
Stopwatch::start('App->beforeFilter()');

parent::beforeFilter();

// must be called before CakeError early return
$this->Themes->theme(Configure::read('Saito.themes'));
$this->Setting->load(Configure::read('Saito.Settings'));
Expand All @@ -124,6 +122,8 @@ public function beforeFilter() {
return;
}

$this->Security->blackHoleCallback = 'blackhole';

$bbcodeSettings = BbcodeSettings::getInstance();
$bbcodeSettings->set(
[
Expand Down Expand Up @@ -293,6 +293,16 @@ protected function _setPageTitle() {
return $_pageTitle;
}

/**
*
*
* @param $type
* @throws Saito\BlackHoledException
*/
public function blackhole($type) {
throw new Saito\BlackHoledException($type);
}

public function initBbcode() {
if (isset($this->_bbcodeInitialized)) {
return;
Expand Down
2 changes: 1 addition & 1 deletion app/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ public function changepassword($id = null) {
throw new BadRequestException();
}

$user = $this->User->findById($id);
$user = $this->User->getProfile($id);
$allowed = $this->_isEditingAllowed($this->CurrentUser, $id);
if (empty($user) || !$allowed) {
throw new \Saito\ForbiddenException("Attempt to change password for user $id.",
Expand Down
13 changes: 12 additions & 1 deletion app/Lib/SaitoExceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class ForbiddenException extends \HttpException {

private $__Logger;
protected $__Logger;

/**
* @throws \InvalidArgumentException
Expand All @@ -19,3 +19,14 @@ public function __construct($message = null, $data = []) {

}

class BlackHoledException extends \BadRequestException {

public function __construct($type = null) {
$message = 'Request was blackholed. Type: ' . $type;
$this->__Logger = new \Saito\Logger\ExceptionLogger();
$this->__Logger->write($message);
parent::__construct($message, 400);
}

}

4 changes: 2 additions & 2 deletions app/Test/Case/Controller/UsersControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function testLoginShowForm() {
'autocomplete' => 'off',
'name' => 'data[User][username]',
'required' => 'required',
'tabindex' => '1',
'tabindex' => '100',
'type' => 'text'
]
];
Expand All @@ -121,7 +121,7 @@ public function testLoginShowForm() {
'autocomplete' => 'off',
'name' => 'data[User][password]',
'required' => 'required',
'tabindex' => '2',
'tabindex' => '101',
'type' => 'password'
]
];
Expand Down
8 changes: 4 additions & 4 deletions app/View/Elements/users/login_form.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
echo $this->Form->input('username', [
'id' => 'tf-login-username',
'label' => __('user_name'),
'tabindex' => 1,
'tabindex' => 100,
'autocomplete' => 'off'
]);

echo $this->Form->input('password', [
'type' => 'password',
'label' => __('user_pw'),
'tabindex' => 2,
'tabindex' => 101,
'autocomplete' => 'off'
]);

Expand All @@ -22,12 +22,12 @@
'style' => 'display: inline;',
],
'type' => 'checkbox', 'style' => 'width: auto;',
'tabindex' => 3,
'tabindex' => 102,
]);

echo $this->Form->submit(__('login_btn'), [
'class' => 'btn btn-submit',
'tabindex' => 4,
'tabindex' => 103,
]);

echo $this->Form->end();
75 changes: 39 additions & 36 deletions app/View/Elements/users/register-form.ctp
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@
<?php

echo $this->Form->create('User', ['action' => 'register']);
echo $this->element('users/register-form-core');
echo $this->SimpleCaptcha->input('User', [
'error' => [
'captchaResultIncorrect' => __d('simple_captcha',
'Captcha result incorrect'),
'captchaResultTooLate' => __d('simple_captcha',
'Captcha result too late'),
'captchaResultTooFast' => __d('simple_captcha',
'Captcha result too fast'),
],
'div' => ['class' => 'input required']
]
);
echo $this->Form->create('User', ['action' => 'register']);
echo $this->element('users/register-form-core');
echo $this->SimpleCaptcha->input('User', [
'error' => [
'captchaResultIncorrect' => __d('simple_captcha',
'Captcha result incorrect'),
'captchaResultTooLate' => __d('simple_captcha',
'Captcha result too late'),
'captchaResultTooFast' => __d('simple_captcha',
'Captcha result too fast'),
],
'div' => ['class' => 'input required'],
'tabindex' => 10
]
);

if (Configure::read('Saito.Settings.tos_enabled')) {
$tosUrl = Configure::read('Saito.Settings.tos_url');
if (empty($tosUrl)) {
$tosUrl = '/pages/' . Configure::read('Config.language') . '/tos';
};
if (Configure::read('Saito.Settings.tos_enabled')) {
$tosUrl = Configure::read('Saito.Settings.tos_url');
if (empty($tosUrl)) {
$tosUrl = '/pages/' . Configure::read('Config.language') . '/tos';
};

echo $this->Form->input('tos_confirm', [
'type' => 'checkbox',
'div' => ['class' => 'input password required'],
'label' => __('register_tos_label',
$this->Html->link(__('register_tos_linktext'),
$tosUrl, ['target' => '_blank']))
]);
echo $this->Js->get('#UserTosConfirm')->event('click',
<<<EOF
echo $this->Form->input('tos_confirm', [
'type' => 'checkbox',
'div' => ['class' => 'input password required'],
'label' => __('register_tos_label',
$this->Html->link(__('register_tos_linktext'),
$tosUrl, ['target' => '_blank'])),
'tabindex' => 11
]);
echo $this->Js->get('#UserTosConfirm')->event('click',
<<<EOF
if (this.checked) {
$('#btn-register-submit').removeAttr("disabled");
} else {
$('#btn-register-submit').attr("disabled", true);
}
return true;
EOF
);
}
);
}

echo $this->Form->submit(__('register_linkname'), [
'id' => 'btn-register-submit',
'class' => 'btn btn-submit',
'disabled' => $tosRequired ? 'disabled' : '',
]);
echo $this->Form->end();
echo $this->Form->submit(__('register_linkname'), [
'id' => 'btn-register-submit',
'class' => 'btn btn-submit',
'disabled' => $tosRequired ? 'disabled' : '',
'tabindex' => 12
]);
echo $this->Form->end();

0 comments on commit f126969

Please sign in to comment.