Style fixes.
This commit is contained in:
parent
a7a59b690a
commit
be4950ff88
43 changed files with 187 additions and 149 deletions
|
|
@ -118,8 +118,11 @@ class AuthController extends ControllerBase
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = new User();
|
$user = new User();
|
||||||
$user->assign($data->toArray(), null,
|
$user->assign(
|
||||||
[ 'email', 'username', 'firstname', 'lastname' ]);
|
$data->toArray(),
|
||||||
|
null,
|
||||||
|
['email', 'username', 'firstname', 'lastname']
|
||||||
|
);
|
||||||
|
|
||||||
$form = new RegistrationForm($user);
|
$form = new RegistrationForm($user);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,8 @@ class CallbackController extends ControllerBase
|
||||||
|
|
||||||
return $this->response->redirect(array(
|
return $this->response->redirect(array(
|
||||||
'for' => 'cb-created',
|
'for' => 'cb-created',
|
||||||
'id' => $callback->getPublicId()));
|
'id' => $callback->getPublicId()
|
||||||
|
));
|
||||||
} else {
|
} else {
|
||||||
foreach ($callback->getMessages() as $msg) {
|
foreach ($callback->getMessages() as $msg) {
|
||||||
$this->flash->error($msg);
|
$this->flash->error($msg);
|
||||||
|
|
@ -71,8 +72,6 @@ class CallbackController extends ControllerBase
|
||||||
$msg .= '</ul>';
|
$msg .= '</ul>';
|
||||||
$this->flash->message('error', $msg);
|
$this->flash->message('error', $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
|
|
@ -85,7 +84,6 @@ class CallbackController extends ControllerBase
|
||||||
{
|
{
|
||||||
$row = CallbackModel::get($id);
|
$row = CallbackModel::get($id);
|
||||||
if (!$row) {
|
if (!$row) {
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->view->id = $id;
|
$this->view->id = $id;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,3 @@ class IndexController extends ControllerBase
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,11 @@ class UserController extends ControllerBase
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Send the email.
|
// Send the email.
|
||||||
$this->di->getMail()->send('Httpcb password activation',
|
$this->di->getMail()->send(
|
||||||
$user->getEmail(), $content);
|
'Httpcb password activation',
|
||||||
|
$user->getEmail(),
|
||||||
|
$content
|
||||||
|
);
|
||||||
|
|
||||||
$msg = "For security reasons. Before a password can be created "
|
$msg = "For security reasons. Before a password can be created "
|
||||||
. "a email has been sent to <strong>{$user->getEmail()}</strong> with "
|
. "a email has been sent to <strong>{$user->getEmail()}</strong> with "
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,14 @@ use Phalcon\Forms\Form;
|
||||||
/**
|
/**
|
||||||
* Element types
|
* Element types
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Phalcon\Forms\Element\Text;
|
use Phalcon\Forms\Element\Text;
|
||||||
use Phalcon\Forms\Element\Submit;
|
use Phalcon\Forms\Element\Submit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validators
|
* Validators
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Phalcon\Validation\Validator\StringLength;
|
use Phalcon\Validation\Validator\StringLength;
|
||||||
|
|
||||||
class CallbackCreate extends Form
|
class CallbackCreate extends Form
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ use Phalcon\Forms\Form;
|
||||||
/**
|
/**
|
||||||
* Element types
|
* Element types
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Phalcon\Forms\Element\Text;
|
use Phalcon\Forms\Element\Text;
|
||||||
use Phalcon\Forms\Element\Password;
|
use Phalcon\Forms\Element\Password;
|
||||||
use Phalcon\Forms\Element\Submit;
|
use Phalcon\Forms\Element\Submit;
|
||||||
|
|
@ -14,6 +15,7 @@ use Phalcon\Forms\Element\Submit;
|
||||||
/**
|
/**
|
||||||
* Validators
|
* Validators
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Phalcon\Validation\Validator\PresenceOf;
|
use Phalcon\Validation\Validator\PresenceOf;
|
||||||
use Phalcon\Validation\Validator\Email as EmailValidator;
|
use Phalcon\Validation\Validator\Email as EmailValidator;
|
||||||
use Phalcon\Validation\Validator\StringLength;
|
use Phalcon\Validation\Validator\StringLength;
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,19 @@ namespace App\Form;
|
||||||
/**
|
/**
|
||||||
* Models
|
* Models
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use App\Model\Data\User;
|
use App\Model\Data\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Phalcon Form
|
* Phalcon Form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Httpcb\Form as FormBase;
|
use Httpcb\Form as FormBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Element types
|
* Element types
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Phalcon\Forms\Element\Text,
|
use Phalcon\Forms\Element\Text,
|
||||||
Phalcon\Forms\Element\Password,
|
Phalcon\Forms\Element\Password,
|
||||||
Phalcon\Forms\Element\Submit;
|
Phalcon\Forms\Element\Submit;
|
||||||
|
|
@ -22,6 +25,7 @@ use Phalcon\Forms\Element\Text,
|
||||||
/**
|
/**
|
||||||
* Validators
|
* Validators
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Phalcon\Validation,
|
use Phalcon\Validation,
|
||||||
Phalcon\Validation\Validator\Callback as CallbackValidator,
|
Phalcon\Validation\Validator\Callback as CallbackValidator,
|
||||||
Phalcon\Validation\Validator\Alnum as AlnumValidator,
|
Phalcon\Validation\Validator\Alnum as AlnumValidator,
|
||||||
|
|
@ -54,7 +58,9 @@ class Registration extends FormBase
|
||||||
'messageMinimum' => 'Username must be at least :min characters long.',
|
'messageMinimum' => 'Username must be at least :min characters long.',
|
||||||
]),
|
]),
|
||||||
new CallbackValidator([
|
new CallbackValidator([
|
||||||
'callback' => function($data) { return User::findFirstByUsername($data['username']) === false; },
|
'callback' => function ($data) {
|
||||||
|
return User::findFirstByUsername($data['username']) === false;
|
||||||
|
},
|
||||||
'message' => 'The username already exists.',
|
'message' => 'The username already exists.',
|
||||||
'attribute' => 'username',
|
'attribute' => 'username',
|
||||||
])
|
])
|
||||||
|
|
@ -87,7 +93,9 @@ class Registration extends FormBase
|
||||||
|
|
||||||
$email->addValidators([
|
$email->addValidators([
|
||||||
new CallbackValidator([
|
new CallbackValidator([
|
||||||
'callback' => function($data) { return User::findFirstByEmail($data['email']) === false; },
|
'callback' => function ($data) {
|
||||||
|
return User::findFirstByEmail($data['email']) === false;
|
||||||
|
},
|
||||||
'message' => 'This email already exist.',
|
'message' => 'This email already exist.',
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,19 @@ namespace App\Form;
|
||||||
/**
|
/**
|
||||||
* Models
|
* Models
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use App\Model\Data\User as UserModel;
|
use App\Model\Data\User as UserModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form
|
* Form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Httpcb\Form as FormBase;
|
use Httpcb\Form as FormBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Element types
|
* Element types
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Phalcon\Forms\Element\Text,
|
use Phalcon\Forms\Element\Text,
|
||||||
Phalcon\Forms\Element\Password,
|
Phalcon\Forms\Element\Password,
|
||||||
Phalcon\Forms\Element\Submit;
|
Phalcon\Forms\Element\Submit;
|
||||||
|
|
@ -22,6 +25,7 @@ use Phalcon\Forms\Element\Text,
|
||||||
/**
|
/**
|
||||||
* Validators
|
* Validators
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Phalcon\Validation\Validator\Callback as CallbackValidator,
|
use Phalcon\Validation\Validator\Callback as CallbackValidator,
|
||||||
Phalcon\Validation\Validator\Uniqueness as UniquenessValidator,
|
Phalcon\Validation\Validator\Uniqueness as UniquenessValidator,
|
||||||
Phalcon\Validation\Validator\Alnum as AlnumValidator,
|
Phalcon\Validation\Validator\Alnum as AlnumValidator,
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,6 @@ class Acl
|
||||||
if ($def instanceof Config) {
|
if ($def instanceof Config) {
|
||||||
$inherits = $def->get('inherits');
|
$inherits = $def->get('inherits');
|
||||||
$description = $def->get('description');
|
$description = $def->get('description');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$role = new Role($name, $description);
|
$role = new Role($name, $description);
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,11 @@ class Auth extends Injectable
|
||||||
|
|
||||||
$this->setIdentity($user->getId());
|
$this->setIdentity($user->getId());
|
||||||
|
|
||||||
$this->eventsManager->fire('auth:onLogin', $this,
|
$this->eventsManager->fire(
|
||||||
"OAuth {$data->getProvider()}");
|
'auth:onLogin',
|
||||||
|
$this,
|
||||||
|
"OAuth {$data->getProvider()}"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
return new Result(Result::SUCCESS);
|
return new Result(Result::SUCCESS);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
namespace Httpcb;
|
namespace Httpcb;
|
||||||
|
|
||||||
class Debug {
|
class Debug
|
||||||
|
{
|
||||||
|
|
||||||
public static function dump($var, $label = null, $echo = true)
|
public static function dump($var, $label = null, $echo = true)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,10 @@ class Form extends FormBase
|
||||||
|
|
||||||
$xhtml .= sprintf(
|
$xhtml .= sprintf(
|
||||||
'<label class="%s" for="%s">%s</label>',
|
'<label class="%s" for="%s">%s</label>',
|
||||||
$opt['label-class'], $ele->getName(), $ele->getLabel());
|
$opt['label-class'],
|
||||||
|
$ele->getName(),
|
||||||
|
$ele->getLabel()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$xhtml .= '<div class="' . implode(' ', $opt['class']) . '">'
|
$xhtml .= '<div class="' . implode(' ', $opt['class']) . '">'
|
||||||
|
|
|
||||||
|
|
@ -126,15 +126,22 @@ class Menu extends Tag
|
||||||
return $xhtml;
|
return $xhtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
$xhtml = self::tagHtml('li', $node->isActive()
|
$xhtml = self::tagHtml(
|
||||||
|
'li',
|
||||||
|
$node->isActive()
|
||||||
? array('class' => $this->_activeClass) : null,
|
? array('class' => $this->_activeClass) : null,
|
||||||
false, false, true);
|
false,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
// Generate the link.
|
// Generate the link.
|
||||||
$xhtml .= self::linkTo($node->getHref(), $node->getCaption());
|
$xhtml .= self::linkTo($node->getHref(), $node->getCaption());
|
||||||
|
|
||||||
if ($node->isActive() && $node->hasChildren()
|
if (
|
||||||
&& ($max_depth === null || $depth < $max_depth)) {
|
$node->isActive() && $node->hasChildren()
|
||||||
|
&& ($max_depth === null || $depth < $max_depth)
|
||||||
|
) {
|
||||||
|
|
||||||
$xhtml .= $this->_renderMenu($node->getChildren(), $depth + 1, $max_depth);
|
$xhtml .= $this->_renderMenu($node->getChildren(), $depth + 1, $max_depth);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,4 +81,3 @@ class Container
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,7 @@ class Services extends DiDefault
|
||||||
if (substr($method->getName(), 0, 11) == '_initShared') {
|
if (substr($method->getName(), 0, 11) == '_initShared') {
|
||||||
$service = lcfirst(substr($method->getName(), 11));
|
$service = lcfirst(substr($method->getName(), 11));
|
||||||
$this->setShared($service, $method->getClosure($this));
|
$this->setShared($service, $method->getClosure($this));
|
||||||
}
|
} else if (substr($method->getName(), 0, 5) == '_init') {
|
||||||
else if (substr($method->getName(),0, 5) == '_init') {
|
|
||||||
$service = lcfirst(substr($method->getName(), 5));
|
$service = lcfirst(substr($method->getName(), 5));
|
||||||
$this->set($service, $method->getClosure($this));
|
$this->set($service, $method->getClosure($this));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@ class ServerUrl extends AbstractHelper
|
||||||
|
|
||||||
// remove port if it's the default port.
|
// remove port if it's the default port.
|
||||||
if (($scheme == 'http' && $port == 80)
|
if (($scheme == 'http' && $port == 80)
|
||||||
|| ($scheme == 'https' && $port == 443)) {
|
|| ($scheme == 'https' && $port == 443)
|
||||||
|
) {
|
||||||
$port = null;
|
$port = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,12 @@ class CreateRequestMetaTable extends AbstractMigration
|
||||||
$table = $this->table('request_meta');
|
$table = $this->table('request_meta');
|
||||||
|
|
||||||
$table->addColumn('callbackid', 'integer');
|
$table->addColumn('callbackid', 'integer');
|
||||||
$table->addForeignKey('callbackid', 'callback', [ 'id' ],
|
$table->addForeignKey(
|
||||||
[ 'constraint' => 'FK_callback' ]);
|
'callbackid',
|
||||||
|
'callback',
|
||||||
|
['id'],
|
||||||
|
['constraint' => 'FK_callback']
|
||||||
|
);
|
||||||
|
|
||||||
$table->addColumn('source_ip', 'string', [
|
$table->addColumn('source_ip', 'string', [
|
||||||
'limit' => 50,
|
'limit' => 50,
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,12 @@ class CreateRequestObjectTable extends AbstractMigration
|
||||||
{
|
{
|
||||||
$table = $this->table('request_object');
|
$table = $this->table('request_object');
|
||||||
|
|
||||||
$table->addForeignKey('id', 'request_meta', ['id'],
|
$table->addForeignKey(
|
||||||
[ 'constraint' => 'FK_request_meta' ]);
|
'id',
|
||||||
|
'request_meta',
|
||||||
|
['id'],
|
||||||
|
['constraint' => 'FK_request_meta']
|
||||||
|
);
|
||||||
|
|
||||||
$table->addColumn('headers', 'blob', [
|
$table->addColumn('headers', 'blob', [
|
||||||
'null' => true,
|
'null' => true,
|
||||||
|
|
|
||||||
|
|
@ -44,4 +44,3 @@ abstract class Base implements ModuleDefinitionInterface
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue