Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed strict error on PHP 5.4 compatibility #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class UsersController extends NiceAuthAppController {
),
'Acl'
);

public function index() {
if ($this->Auth->user('id')) {
$user = $this->User->findById($this->Auth->user());
Expand Down Expand Up @@ -65,7 +65,7 @@ public function index() {
$this->redirect('/login');
}
}

public function beforeFilter() {
parent::beforeFilter();
$this->Auth->userModel = 'User';
Expand All @@ -79,7 +79,7 @@ private function fixAlias() {
$this->Aro->findByForeignKey($user['User']['id']);
$this->Aro->save(array('alias' => $user['User']['username']));
}

private function sendEmail($type, $to, $vars = null) {
if ($type == "registration" && Configure::read('NiceAuth.regEmail') == true) {
$email = new CakeEmail('default');
Expand All @@ -97,10 +97,10 @@ private function sendEmail($type, $to, $vars = null) {
->subject(Configure::read('NiceAuth.resetSubject'))
->template('NiceAuth.reset')
->viewVars($vars)
->send();
->send();
}
}

public function passwordReset() {
if ($this->request->is('post')) {
if ($user = $this->User->findByEmail($this->request->data['User']['email'])) {
Expand All @@ -116,7 +116,7 @@ public function passwordReset() {
else {
$this->Session->setFlash('The email address you entered could not be found.');
}
}
}
}

public function register(){
Expand Down Expand Up @@ -169,6 +169,7 @@ public function register(){
}

public function login(){
$this->layout = 'login';
if ($this->request->is('post') || ($this->request->is('get') && isset($this->request->query['openid_mode']))) {
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirect());
Expand All @@ -178,7 +179,7 @@ public function login(){
}
}
}

public function openid() {
if ($this->request->is('post')) {
$openid = new Lightopenid($_SERVER['SERVER_NAME']);
Expand Down
2 changes: 1 addition & 1 deletion Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function parentNode() {
)
);

public function beforeSave() {
public function beforeSave($options = array()) {
if (isset($this->data[$this->alias]['password'])) {
$this->data[$this->alias]['password'] = AuthComponent::password($this->data[$this->alias]['password']);
}
Expand Down
35 changes: 35 additions & 0 deletions View/Layouts/login.ctp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php echo $this->Html->docType('html5'); ?>
<html lang="en">
<head>
<?php echo $this->Html->charset(); ?>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="description" content="<?php echo Configure::read('App.meta.description'); ?>">
<meta name="author" content="<?php echo Configure::read('App.meta.author'); ?>">
<title><?php echo $title_for_layout; ?></title>
<?php
echo $this->Html->meta('icon');

echo $this->fetch('meta');

echo $this->Html->css('bootstrap3');
echo $this->Html->css('application');
echo $this->Html->css('signin');

echo $this->fetch('css');

echo $this->fetch('script');
?>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<?php echo $this->Html->script('html5shiv'); ?>
<?php echo $this->Html->script('respond.min'); ?>
<![endif]-->
</head>
<body>
<div class="container">
<?php echo $this->Session->flash(); ?>
<?php echo $this->fetch('content'); ?>
</div>
<?php echo $this->element('sql_dump'); ?>
</body>
</html>
3 changes: 2 additions & 1 deletion View/Users/login.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
?>
</fieldset>
<?php echo $this->Form->end(__('Login'));?>

<?php /* // @todo: make this better looking
<form action="<?php echo $this->Html->url('/users/openid'); ?>" method="post" id="openid_form">
<input type="hidden" name="action" value="verify" />
<input type="hidden" name="type" value="login" />
Expand All @@ -44,3 +44,4 @@
</noscript>
</fieldset>
</form>
*/ ?>
2 changes: 1 addition & 1 deletion webroot/js/openid-jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ openid = {
cookie_name : 'openid_provider',
cookie_path : '/',

img_path : '/nice_auth/img',
img_path : '/nice_auth/img/',
locale : null, // is set in openid-<locale>.js
sprite : null, // usually equals to locale, is set in
// openid-<locale>.js
Expand Down