Re: authenticate wont reroute

2014-08-07 Thread ajt
I still cant get this to work, htaccess is not the answers for unauthroized 
users.
If it is then could someone please show me the code.

How does cakephp handle unauthroized access from the address bat?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Migrations question

2014-08-07 Thread John Sposato
We have three environments: Dev, Staging and Prod.  How would you recommend 
handling adding migrations after a project has already been released to all 
the environments.  It seems like the statements generated don't take into 
account that some tables may already exist.  Is there a workaround?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Getting rid of CakePHP's default routes.

2014-08-07 Thread Nethues_Developer
Open the app/Config/routes.php file and comment or erase this line (should 
be at the bottom of the file)

*require CAKE . 'Config' . DS . 'routes.php';*

Remember to define your routes otherwise this won't work well.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Authentication redirect problem when not logged in

2014-08-07 Thread euromark
careful, the convention is to use lowercase: plugin => coaster_cms


Am Donnerstag, 7. August 2014 16:24:41 UTC+2 schrieb Domingos Coelho:
>
> Inform the login action:
>
> public $components = array('Auth' => array(
> 'loginAction' => array('controller' => 'users', 'action' => 'login' , 
> 'plugin' => 'CoasterCms')
> ));
>
> Em quarta-feira, 6 de agosto de 2014 09h59min16s UTC-4, Sam Clauw escreveu:
>>
>> I reached the authentication part of my CakePHP based cms system, things 
>> are going very well (thanks to you guys) ;)
>> As in every application, I should ask for a username / password 
>> combination when somebody tries to get into my CMS. This CMS is build as a 
>> plugin and is called "CoasterCms". Without login, you can reach it by the 
>> following url for example:
>>
>> http://new.bellewaerdefun.be/coaster_cms/attractions/index
>>
>>
>> Now, when I change my CoasterCmsAppController.php and update my 
>> $components variable with the "Auth" array value:
>>
>> class CoasterCmsAppController extends AppController
>>> {
>>> ...
>>> 
>>> public $components = array(
>>> 'Session',
>>> 'Paginator'/*,
>>> 'Auth' => array(
>>> 'loginRedirect' => array(
>>> 'plugin' => 'CoasterCms',
>>> 'controller' => 'attractions',
>>> 'action' => 'index'
>>> ),
>>> 'logoutRedirect' => array(
>>> 'plugin' => 'CoasterCms',
>>> 'controller' => 'attractions',
>>> 'action' => 'index',
>>> ),
>>> 'authenticate' => array(
>>> 'Form' => array(
>>> 'passwordHasher' => 'Blowfish'
>>> )
>>> )
>>> )*/
>>> );
>>> ...
>>> }
>>
>>
>> ... then I'm constantly redirected to the url:
>>
>> http://new.bellewaerdefun.be/users/login
>>
>>
>> What's the reason of that and how can I change it so I can link it to the 
>> plugin? 
>>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: authenticate wont reroute

2014-08-07 Thread ajt
the user is not authenticated and if they try to access a webpage they 
shouldnt then surely I can code for this .
The problem doesnt happen if authentiation isnt used so it must be able to 
be controlled with authentication otherwise how does ./htaccess have any 
idea 
of what user is accessing a webpage

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Authentication redirect problem when not logged in

2014-08-07 Thread Domingos Coelho
Inform the login action:

public $components = array('Auth' => array(
'loginAction' => array('controller' => 'users', 'action' => 'login' , 
'plugin' => 'CoasterCms')
));

Em quarta-feira, 6 de agosto de 2014 09h59min16s UTC-4, Sam Clauw escreveu:
>
> I reached the authentication part of my CakePHP based cms system, things 
> are going very well (thanks to you guys) ;)
> As in every application, I should ask for a username / password 
> combination when somebody tries to get into my CMS. This CMS is build as a 
> plugin and is called "CoasterCms". Without login, you can reach it by the 
> following url for example:
>
> http://new.bellewaerdefun.be/coaster_cms/attractions/index
>
>
> Now, when I change my CoasterCmsAppController.php and update my 
> $components variable with the "Auth" array value:
>
> class CoasterCmsAppController extends AppController
>> {
>> ...
>> 
>> public $components = array(
>> 'Session',
>> 'Paginator'/*,
>> 'Auth' => array(
>> 'loginRedirect' => array(
>> 'plugin' => 'CoasterCms',
>> 'controller' => 'attractions',
>> 'action' => 'index'
>> ),
>> 'logoutRedirect' => array(
>> 'plugin' => 'CoasterCms',
>> 'controller' => 'attractions',
>> 'action' => 'index',
>> ),
>> 'authenticate' => array(
>> 'Form' => array(
>> 'passwordHasher' => 'Blowfish'
>> )
>> )
>> )*/
>> );
>> ...
>> }
>
>
> ... then I'm constantly redirected to the url:
>
> http://new.bellewaerdefun.be/users/login
>
>
> What's the reason of that and how can I change it so I can link it to the 
> plugin? 
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: authenticate wont reroute

2014-08-07 Thread Stephen S
Sounds like it's nothing to do with Auth but as Leandro suggested your
directory structure and web settings / .htaccess.


On 7 August 2014 15:18, ajt  wrote:

>   //ajt
>  public $components = array(
>
>  "Email",
> 'Session',
> 'Auth' => array(
> 'loginRedirect' => array('controller' => 'users', 'action' =>
> 'dashboard'),
> 'logoutRedirect' => array('controller' => 'users','action' =>
> 'login'  ),
>  'authorize' => array('Controller'), // Added this line
> // array('DebugKit.Toolbar' => array( 'panels' =>
> array('MyCustom', 'timer'=>false))),
>
> ));
>
>
> public function isAuthorized($user) {
> // Admin can access every action
>   //  debug($user['role']);
>// debug("asdd");
>
> if (isset($user['role']) && $user['role'] === 'admin') {
> return true;
> }
>//  return $this->Auth->redirectUrl();
> // Default deny
> return false;
> }
>
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Kind Regards
 Stephen Speakman

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: authenticate wont reroute

2014-08-07 Thread ajt
  //ajt
 public $components = array(

 "Email",
'Session',
'Auth' => array(
'loginRedirect' => array('controller' => 'users', 'action' => 
'dashboard'),
'logoutRedirect' => array('controller' => 'users','action' => 
'login'  ),
 'authorize' => array('Controller'), // Added this line   
// array('DebugKit.Toolbar' => array( 'panels' => array('MyCustom', 
'timer'=>false))),

));
 
 
public function isAuthorized($user) {
// Admin can access every action
  //  debug($user['role']);
   // debug("asdd");

if (isset($user['role']) && $user['role'] === 'admin') {
return true;
}
   //  return $this->Auth->redirectUrl();
// Default deny
return false;
}
  
 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: authenticate wont reroute

2014-08-07 Thread Leandro Mouta
I had the same problem. It only works when I put the app in DocumentRoot,
not in a subfolder.


2014-08-07 11:06 GMT-03:00 ajt :

> This didnt work.
>
> If the user tries to type the url manually in the adress bar  then
> isauthorized doesnt route the unauthorized user anywhere but root dir and
> how do i code for this?
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: authenticate wont reroute

2014-08-07 Thread Stephen S
Please post your Auth component setup, isAuthorized isn't responsible for
which URL to redirect to - it only returns true or false, you can place a
redirect in there but it's better to fix the problem anyway.


On 7 August 2014 15:06, ajt  wrote:

> This didnt work.
>
> If the user tries to type the url manually in the adress bar  then
> isauthorized doesnt route the unauthorized user anywhere but root dir and
> how do i code for this?
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Kind Regards
 Stephen Speakman

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: authenticate wont reroute

2014-08-07 Thread ajt
This didnt work.

If the user tries to type the url manually in the adress bar  then 
isauthorized doesnt route the unauthorized user anywhere but root dir and 
how do i code for this?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: authenticate wont reroute

2014-08-07 Thread Stephen S
It looks like you're using isAuthorized wrong, assuming your /students/
path is a prefix, you would do something like this.

if($this->params['prefix'] == 'students' && $user['role'] !== 'student') {
return false; // Only students can access
/students// etc
}

return true; // No checks failed, have at it.

If you're students url is a controller not a prefix just change the
condition to match, do this for each role. If there is a redirect problem
it's likely to be with your Auth setup not isAuthorised as isAuthorised
should only really return true or false.


On 7 August 2014 13:58, ajt  wrote:

> Hi,
>
> I can authenticate a user but I get problems when a user tries to access
> from the address bar a webpage it hasnt got access to.
> What happens is that I get routed to the base index file with
> missingControler error.
> SO my path is /crm/students on a webpage the user should not access
> and then i get directed to /crm/crm/
>
> public function isAuthorized($user) {
>
>
> if (isset($user['role']) && $user['role'] === 'manager') {
> return true;
> }
>if (isset($user['role']) && $user['role'] === 'student') {
> return true;
> }
>
>  if (isset($user['role']) && $user['role'] === 'teacher') {
> return false;
> }
>
>  return parent::isAuthorized($user);
> }
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Kind Regards
 Stephen Speakman

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


authenticate wont reroute

2014-08-07 Thread ajt
Hi,

I can authenticate a user but I get problems when a user tries to access 
from the address bar a webpage it hasnt got access to.
What happens is that I get routed to the base index file with 
missingControler error.
SO my path is /crm/students on a webpage the user should not access and 
then i get directed to /crm/crm/

public function isAuthorized($user) {
 
   
if (isset($user['role']) && $user['role'] === 'manager') {
return true;
}
   if (isset($user['role']) && $user['role'] === 'student') {
return true;
}

 if (isset($user['role']) && $user['role'] === 'teacher') {
return false;
}

 return parent::isAuthorized($user);
}
  

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: cant use email as login cakephp

2014-08-07 Thread ajt
Hi,

I started it again and the problem was I had email as the username field. 
Cakephp is looking for username

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Credit card Expiry Date format in CakePHP 3

2014-08-07 Thread Jipson Thomas
Hi,
Is there any option to use the form input type date for the credit card 
expiry date. I mean we just need the year and month inputs only not the 
day. I used the following but  still I am getting the full date as 
2014-August-7
  echo $this->Form->date('expirationDate', [
'label' => 'Expiry Date',
'minYear' => date('Y'),
'maxYear' => date('Y')+5,
'dateFormat' => 'Y-m'
]);

Thanks 
Jipson

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.