User login authentication using web services

2013-03-19 Thread Sam
Dear Cakephp experts,

User login authentication can be readily achieved by the Authentication 
component. However, I would like to have user login authentication using 
web services. I have an Android app which I want the user to be 
authenticated against a CakePHP app. May I know whether this can be done? 
Are there ready components which can do this?

Thank you.




-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: User login authentication using web services

2013-03-19 Thread Sam
Just to add that I am using CakePHP ver2.2

On Tuesday, March 19, 2013 3:16:59 PM UTC+8, Sam wrote:

 Dear Cakephp experts,

 User login authentication can be readily achieved by the Authentication 
 component. However, I would like to have user login authentication using 
 web services. I have an Android app which I want the user to be 
 authenticated against a CakePHP app. May I know whether this can be done? 
 Are there ready components which can do this?

 Thank you.






-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




I have a problem when i am creating user login authentication

2010-04-29 Thread Narendra Padala


Hi..Every one ,
i am using postgresql database for cake when i am creating the user
authentication its show errors,
hope u i wrote properly but it shows Error, i wrote code like this
please any one can help me out.


My Database Table Name tbluser 
--


 Columns|  Type
|  Modifiers
+
+-
 lnguser| integer| not null default
nextval(('tbluser_lnguser_seq'::text)::regclass)
 strfname   | character varying(100) | not null
 strlname   | character varying(100) | not null
 struid | character varying(100) | not null
 strpid | character varying(100) | not null
 lnguser_group  | integer| not null
 strtelarea | character varying(20)  |
 strtelno   | character varying(20)  |
 stremail   | character varying(100) |
 struserconfirm | character varying(100) |
 dtmregistered  | date   |
 dtmapproved| date   |
 blnchatuser| bit(1) |
Indexes:
tbluser_pkey PRIMARY KEY, btree (lnguser)


--

Model : tbluser.php

class Tbluser extends AppModel {

var $useTable = 'tbluser';

}


--

Controller:tblusers_controller.php


class TblusersController extends AppController {

var $name = Tblusers;

function login() {

}

function index() {

}
function logout() {

$this-Session-setFlash('Logout');

$this-redirect($this-Auth-logout());
}
}

--
App Controller :app_controller.php


class AppController extends Controller {

var $uses=array('Tbluser');

var $components = array('Auth');

function beforeFilter(){
$this-Auth-loginRedirect = array('controller'= 'tblusers',
   'action' = 'index');
$this-Auth-logoutRedirect = array('controller'= 'tblusers',
'action' = 'login');

$this-Auth-allow('login');

$this-Auth-authorize = 'controller';

$this-set('loggedIn', $this-Auth-Tbluser('lnguser')); //
Here I am getting the error
}

function isAuthorized() {
return true;
}
}


viewfile : login.ctp

 ?php echo $form-create('Tbluser',
  array(
  'action' = 'login'));
 ?
table border=0 cellspacing=0
cellpadding=0
tr
td align=center
valign=middleUSERNAME/td
td align=center valign=middle/
td
td align=center valign=middle
?php
 e($form-text('struid'));
?
/td
tdnbsp;/td
/tr
tr
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
/tr
tr
td align=center
valign=middlePASSWORD/td
td align=center valign=middle/
td
td align=center valign=middle
?php
echo $form-
password('strpid');
?
/td
tdnbsp;/td
/tr
tr
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
/tr
/table

?php
  echo $form-
submit('signin.gif',array(
 'onclick'
= 'validate()'));

?

?php echo $form-end(); ?

-
Fatal error: Call to undefined method AuthComponent::tbluser() in /
home/narendra/wizard_mvc/app/app_controller.php


Please help me out.! Thanks in advance

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email 

Re: I have a problem when i am creating user login authentication

2010-04-29 Thread Andrei Mita
I believe your table should be pluralized: users

Also, why do you use tbl before you table names?


On Thu, Apr 29, 2010 at 10:11 AM, Narendra Padala crazycake...@gmail.comwrote:



 Hi..Every one ,
 i am using postgresql database for cake when i am creating the user
 authentication its show errors,
 hope u i wrote properly but it shows Error, i wrote code like this
 please any one can help me out.


 My Database Table Name tbluser 
 --


 Columns|  Type
 |  Modifiers
 +
 +-
  lnguser| integer| not null default
 nextval(('tbluser_lnguser_seq'::text)::regclass)
  strfname   | character varying(100) | not null
  strlname   | character varying(100) | not null
  struid | character varying(100) | not null
  strpid | character varying(100) | not null
  lnguser_group  | integer| not null
  strtelarea | character varying(20)  |
  strtelno   | character varying(20)  |
  stremail   | character varying(100) |
  struserconfirm | character varying(100) |
  dtmregistered  | date   |
  dtmapproved| date   |
  blnchatuser| bit(1) |
 Indexes:
tbluser_pkey PRIMARY KEY, btree (lnguser)



 --

 Model : tbluser.php

 class Tbluser extends AppModel {

var $useTable = 'tbluser';

 }


 --

 Controller:tblusers_controller.php


 class TblusersController extends AppController {

var $name = Tblusers;

function login() {

}

function index() {

}
function logout() {

$this-Session-setFlash('Logout');

$this-redirect($this-Auth-logout());
}
 }

 --
 App Controller :app_controller.php


 class AppController extends Controller {

var $uses=array('Tbluser');

var $components = array('Auth');

function beforeFilter(){
$this-Auth-loginRedirect = array('controller'= 'tblusers',
   'action' = 'index');
$this-Auth-logoutRedirect = array('controller'= 'tblusers',
'action' = 'login');

$this-Auth-allow('login');

$this-Auth-authorize = 'controller';

$this-set('loggedIn', $this-Auth-Tbluser('lnguser')); //
 Here I am getting the error
}

function isAuthorized() {
return true;
}
 }

 
 viewfile : login.ctp

 ?php echo $form-create('Tbluser',
  array(
  'action' = 'login'));
 ?
table border=0 cellspacing=0
 cellpadding=0
tr
td align=center
 valign=middleUSERNAME/td
td align=center valign=middle/
 td
td align=center valign=middle
?php
 e($form-text('struid'));
?
/td
tdnbsp;/td
/tr
tr
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
/tr
tr
td align=center
 valign=middlePASSWORD/td
td align=center valign=middle/
 td
td align=center valign=middle
?php
echo $form-
 password('strpid');
?
/td
tdnbsp;/td
/tr
tr
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
/tr
/table

?php
  echo $form-
 submit('signin.gif',array(
 'onclick'
 = 'validate()'));

?

?php echo $form-end(); ?

 -
 Fatal error: Call to undefined method AuthComponent::tbluser() in /
 home/narendra/wizard_mvc/app/app_controller.php


 Please help me out.! Thanks in advance

 

Re: I have a problem when i am creating user login authentication

2010-04-29 Thread Narendra Padala
Its currently running project, thats why are not at all do any changes in
the database table.
I have to use the same table only, i have no right to change the table, is
their any way please help me out
On Thu, Apr 29, 2010 at 12:48 PM, Andrei Mita andrei.m...@gmail.com wrote:

 I believe your table should be pluralized: users

 Also, why do you use tbl before you table names?



 On Thu, Apr 29, 2010 at 10:11 AM, Narendra Padala 
 crazycake...@gmail.comwrote:



 Hi..Every one ,
 i am using postgresql database for cake when i am creating the user
 authentication its show errors,
 hope u i wrote properly but it shows Error, i wrote code like this
 please any one can help me out.


 My Database Table Name tbluser 
 --


 Columns|  Type
 |  Modifiers
 +
 +-
  lnguser| integer| not null default
 nextval(('tbluser_lnguser_seq'::text)::regclass)
  strfname   | character varying(100) | not null
  strlname   | character varying(100) | not null
  struid | character varying(100) | not null
  strpid | character varying(100) | not null
  lnguser_group  | integer| not null
  strtelarea | character varying(20)  |
  strtelno   | character varying(20)  |
  stremail   | character varying(100) |
  struserconfirm | character varying(100) |
  dtmregistered  | date   |
  dtmapproved| date   |
  blnchatuser| bit(1) |
 Indexes:
tbluser_pkey PRIMARY KEY, btree (lnguser)



 --

 Model : tbluser.php

 class Tbluser extends AppModel {

var $useTable = 'tbluser';

 }


 --

 Controller:tblusers_controller.php


 class TblusersController extends AppController {

var $name = Tblusers;

function login() {

}

function index() {

}
function logout() {

$this-Session-setFlash('Logout');

$this-redirect($this-Auth-logout());
}
 }

 --
 App Controller :app_controller.php


 class AppController extends Controller {

var $uses=array('Tbluser');

var $components = array('Auth');

function beforeFilter(){
$this-Auth-loginRedirect = array('controller'= 'tblusers',
   'action' = 'index');
$this-Auth-logoutRedirect = array('controller'= 'tblusers',
'action' = 'login');

$this-Auth-allow('login');

$this-Auth-authorize = 'controller';

$this-set('loggedIn', $this-Auth-Tbluser('lnguser')); //
 Here I am getting the error
}

function isAuthorized() {
return true;
}
 }

 
 viewfile : login.ctp

 ?php echo $form-create('Tbluser',
  array(
  'action' = 'login'));
 ?
table border=0 cellspacing=0
 cellpadding=0
tr
td align=center
 valign=middleUSERNAME/td
td align=center valign=middle/
 td
td align=center valign=middle
?php
 e($form-text('struid'));
?
/td
tdnbsp;/td
/tr
tr
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
/tr
tr
td align=center
 valign=middlePASSWORD/td
td align=center valign=middle/
 td
td align=center valign=middle
?php
echo $form-
 password('strpid');
?
/td
tdnbsp;/td
/tr
tr
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
/tr
/table

?php
  echo $form-
 submit('signin.gif',array(
 'onclick'
 = 'validate()'));

  

Re: I have a problem when i am creating user login authentication

2010-04-29 Thread Sergei
Try this

$this-set('loggedIn', $this-Auth-user('lnguser'));



On Apr 29, 5:14 pm, Narendra Padala crazycake...@gmail.com wrote:
 Its currently running project, thats why are not at all do any changes in
 the database table.
 I have to use the same table only, i have no right to change the table, is
 their any way please help me out

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: I have a problem when i am creating user login authentication

2010-04-29 Thread Andrei Mita
What error do you get?

On Thu, Apr 29, 2010 at 11:14 AM, Narendra Padala crazycake...@gmail.comwrote:

 Its currently running project, thats why are not at all do any changes in
 the database table.
 I have to use the same table only, i have no right to change the table, is
 their any way please help me out

 On Thu, Apr 29, 2010 at 12:48 PM, Andrei Mita andrei.m...@gmail.comwrote:

 I believe your table should be pluralized: users

 Also, why do you use tbl before you table names?



 On Thu, Apr 29, 2010 at 10:11 AM, Narendra Padala crazycake...@gmail.com
  wrote:



 Hi..Every one ,
 i am using postgresql database for cake when i am creating the user
 authentication its show errors,
 hope u i wrote properly but it shows Error, i wrote code like this
 please any one can help me out.


 My Database Table Name tbluser 
 --


 Columns|  Type
 |  Modifiers
 +
 +-
  lnguser| integer| not null default
 nextval(('tbluser_lnguser_seq'::text)::regclass)
  strfname   | character varying(100) | not null
  strlname   | character varying(100) | not null
  struid | character varying(100) | not null
  strpid | character varying(100) | not null
  lnguser_group  | integer| not null
  strtelarea | character varying(20)  |
  strtelno   | character varying(20)  |
  stremail   | character varying(100) |
  struserconfirm | character varying(100) |
  dtmregistered  | date   |
  dtmapproved| date   |
  blnchatuser| bit(1) |
 Indexes:
tbluser_pkey PRIMARY KEY, btree (lnguser)



 --

 Model : tbluser.php

 class Tbluser extends AppModel {

var $useTable = 'tbluser';

 }


 --

 Controller:tblusers_controller.php


 class TblusersController extends AppController {

var $name = Tblusers;

function login() {

}

function index() {

}
function logout() {

$this-Session-setFlash('Logout');

$this-redirect($this-Auth-logout());
}
 }

 --
 App Controller :app_controller.php


 class AppController extends Controller {

var $uses=array('Tbluser');

var $components = array('Auth');

function beforeFilter(){
$this-Auth-loginRedirect = array('controller'= 'tblusers',
   'action' = 'index');
$this-Auth-logoutRedirect = array('controller'= 'tblusers',
'action' = 'login');

$this-Auth-allow('login');

$this-Auth-authorize = 'controller';

$this-set('loggedIn', $this-Auth-Tbluser('lnguser')); //
 Here I am getting the error
}

function isAuthorized() {
return true;
}
 }

 
 viewfile : login.ctp

 ?php echo $form-create('Tbluser',
  array(
  'action' = 'login'));
 ?
table border=0 cellspacing=0
 cellpadding=0
tr
td align=center
 valign=middleUSERNAME/td
td align=center valign=middle/
 td
td align=center valign=middle
?php
 e($form-text('struid'));
?
/td
tdnbsp;/td
/tr
tr
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
/tr
tr
td align=center
 valign=middlePASSWORD/td
td align=center valign=middle/
 td
td align=center valign=middle
?php
echo $form-
 password('strpid');
?
/td
tdnbsp;/td
/tr
tr
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
/tr
/table

?php
  echo $form-
 submit('signin.gif',array(
   

Re: Simple cakePHP login authentication

2009-07-21 Thread Dhileepen Chakravarthy
Issac,
I done that example.

http://www.studiocanaria.com/articles/cakephp_auth_component_users_groups_permissions_revisited

i have few doubts,

how do i create main page with logout.

i have placed this line in app_controller.php

$this-Auth-loginRedirect = '/posts';

and, created index.ctp in posts folder and posts_controller.php

Actual learning is i would like to merge blog post and login authntication
aplication to single sample application

Any great tips

Regards,
Dhileep

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Login authentication

2009-07-20 Thread Dhileepen Chakravarthy
Thank you for your reply.
But its not working.I dnt know where i did a mistake.

I am using two tables one is posts and users.

Login i use *'users' *table. inside i am using *'posts'* table for
displaying blog posts.

index.ctp for login screen with form fields. ( $form-create('Post',
array('action' = 'login')) )
posts_cotroller.php for action code.
post for model.

how do i use here user model and users_controller.php here for
authentication.

if i using those  controller goes into users folder. but my application in
posts folder only.

Regards,
Dhileep

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Simple cakePHP login authentication

2009-07-20 Thread Dhileepen Chakravarthy
Hi Everybody

Please refer good url for simple cakePHP login form
If any body wrote a code is very much appreciated.

Regards,
Dhileep

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple cakePHP login authentication

2009-07-20 Thread jeff
pha ..

u never will learn,if u dont  try to do it by urself.after reading
the docs

its a simple process

dont expect everthing to be done by others
..

this time am not helping you...

find it urself.

hint use this link

http://book.cakephp.org/view/172/Authentication

On Mon, Jul 20, 2009 at 4:16 PM, Dhileepen Chakravarthy 
dhileepen.cake...@gmail.com wrote:

 Hi Everybody

 Please refer good url for simple cakePHP login form
 If any body wrote a code is very much appreciated.

 Regards,
 Dhileep

 



-- 
-- 
(¨`•.•´¨) I may be busy,
`•.¸(¨`•.•´¨)  but I assure you,
(¨`•.•´¨)¸.•´ you are always in my heart
`•.¸.•´


With Lots of Love.

THANKS AND REGARDS

Jeffery Jacob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple cakePHP login authentication

2009-07-20 Thread Isaac Raja
Hi Dhileep,

Goto github or googlecode search for cakephp, you will find some opensource
cakephp applications,

check for the login authentication system there.  it's easy.


Regards,
Isaac

On Mon, Jul 20, 2009 at 4:29 PM, jeff jeffery2k2...@gmail.com wrote:

 pha ..

 u never will learn,if u dont  try to do it by urself.after reading
 the docs

 its a simple process

 dont expect everthing to be done by others
 ..

 this time am not helping you...

 find it urself.

 hint use this link

 http://book.cakephp.org/view/172/Authentication

 On Mon, Jul 20, 2009 at 4:16 PM, Dhileepen Chakravarthy 
 dhileepen.cake...@gmail.com wrote:

 Hi Everybody

 Please refer good url for simple cakePHP login form
 If any body wrote a code is very much appreciated.

 Regards,
 Dhileep





 --
 --
 (¨`•.•´¨) I may be busy,
 `•.¸(¨`•.•´¨)  but I assure you,
 (¨`•.•´¨)¸.•´ you are always in my heart
 `•.¸.•´


 With Lots of Love.

 THANKS AND REGARDS

 Jeffery Jacob



 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple cakePHP login authentication

2009-07-20 Thread Dhileepen Chakravarthy
Hi Jeff,

http://bakery.cakephp.org/articles/view/simple-form-authentication-in-1-2-x-x


I tried with this sample program but its not giving error or nothing. Simply
it gives blank page.

Other's are complecated wa of coding with Auth component and they wont give
complete.

Anyway i ll try to learn Issac tip

Regards,
Dhileep

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple cakePHP login authentication

2009-07-20 Thread Isaac Raja
Hi dhileep,




Here is where i learned authentication in cakephp


http://www.studiocanaria.com/articles/cakephp_auth_component_users_groups_permissions_revisited


It also tells how to create groups  permissions.


Thanks,
Isaac

On Mon, Jul 20, 2009 at 4:40 PM, Dhileepen Chakravarthy 
dhileepen.cake...@gmail.com wrote:

 Hi Jeff,


 http://bakery.cakephp.org/articles/view/simple-form-authentication-in-1-2-x-x


 I tried with this sample program but its not giving error or nothing.
 Simply it gives blank page.

 Other's are complecated wa of coding with Auth component and they wont give
 complete.

 Anyway i ll try to learn Issac tip

 Regards,
 Dhileep

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple cakePHP login authentication

2009-07-20 Thread Dhileepen Chakravarthy
Thanks Issac,

This type of url only i tried in google :)

Regards,
Dhileep

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Login authentication

2009-07-20 Thread Carlos Lavin
$form-create('User', array('action' = 'login'))

2009/7/20 Dhileepen Chakravarthy dhileepen.cake...@gmail.com

 Thank you for your reply.
 But its not working.I dnt know where i did a mistake.

 I am using two tables one is posts and users.

 Login i use *'users' *table. inside i am using *'posts'* table for
 displaying blog posts.

 index.ctp for login screen with form fields. ( $form-create('Post',
 array('action' = 'login')) )
 posts_cotroller.php for action code.
 post for model.

 how do i use here user model and users_controller.php here for
 authentication.

 if i using those  controller goes into users folder. but my application in
 posts folder only.

 Regards,
 Dhileep



 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Login authentication

2009-07-20 Thread brian

You should have the login()  logout() methods in UsersController. See here:

http://book.cakephp.org/view/172/Authentication
http://www.webdevelopment2.com/cakephp-auth-component-tutorial-1/
http://www.webdevelopment2.com/cakephp-auth-component-tutorial-2/

On Mon, Jul 20, 2009 at 3:19 AM, Dhileepen
Chakravarthydhileepen.cake...@gmail.com wrote:
 Thank you for your reply.

 But its not working.I dnt know where i did a mistake.

 I am using two tables one is posts and users.

 Login i use 'users' table. inside i am using 'posts' table for displaying
 blog posts.

 index.ctp for login screen with form fields. ( $form-create('Post',
 array('action' = 'login')) )
 posts_cotroller.php for action code.
 post for model.

 how do i use here user model and users_controller.php here for
 authentication.

 if i using those  controller goes into users folder. but my application in
 posts folder only.

 Regards,
 Dhileep


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Login authentication

2009-07-19 Thread Dhileepen Chakravarthy
Thanks for your reply Thiago.

But my problem was not solved.

My login page in this directory,

http://localhost/cake/posts/

named index.ctp

if i replace use your function then i got a following error.

Query: SELECT `Post`.`id`, `Post`.`username` FROM `posts` AS `Post`   WHERE
`username` = 's' AND `password` = 's'LIMIT 1

My table name is Users but it refer Post . Post is my controller name.

Please clear my doubt. I dont know which place i did a mistake. how do i
refer my table named users

Regards,
Dhileep

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Login authentication

2009-07-19 Thread Vijay Kumbhar
Hey Dhileepen,

In cake the model uses the bydefault table as per its name. As like you are
using post model so it will take the table as posts.
For using another table you have to specify in that model like,

var $useTable = 'tablemame';

Then it will uses the table other than model name.

For more info please read this,

http://book.cakephp.org/view/436/useTable

also if you are getting the error like the 1st post

Notice (8): Undefined index:  username [APP\controllers\posts_controller.php,
line 60]

you can resolve this error by print_r(arrayname);

so you can check the array / array variables that you are using is correct
or not.


On Mon, Jul 20, 2009 at 10:37 AM, Dhileepen Chakravarthy 
dhileepen.cake...@gmail.com wrote:

 Thanks for your reply Thiago.

 But my problem was not solved.

 My login page in this directory,

 http://localhost/cake/posts/

 named index.ctp

 if i replace use your function then i got a following error.

 Query: SELECT `Post`.`id`, `Post`.`username` FROM `posts` AS `Post`   WHERE
 `username` = 's' AND `password` = 's'LIMIT 1

 My table name is Users but it refer Post . Post is my controller name.

 Please clear my doubt. I dont know which place i did a mistake. how do i
 refer my table named users

 Regards,
 Dhileep





 



-- 
Thanks  Regards,
Vijayk.
Co-founder (www.weboniselab.com)

You Bring the Dreams, We'll Bring the Means

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Login authentication

2009-07-17 Thread Dhileepen Chakravarthy
Hi Everybody,

*I. mysql db*
users table with id username and password field.

*II. index.ctp*
div class=login
h2Login/h2
?php echo $form-create('Post', array('action' = 'login'))?
?php echo $form-input('username');?
?php echo $form-input('password');?
?php echo $form-submit('Login');?
  ?php echo $form-button('Reset', array('type'='reset',
'action'='clearLogin'));?
?php echo $form-end(); ?
/div

*III. posts_controller.php*
function login()
 {
  if(empty($this-data) == false)
{
if(($user = $this-Post-validateLogin($this-data['username']))
== true)
{
$this-Session-write('Post', $user);
$this-Session-setFlash('You\'ve successfully logged in.');
$this-redirect('main');
exit();
}
else
{
$this-Session-setFlash('Sorry, the information you\'ve
entered is incorrect.');
exit();
}
}
 }
 function clearLogin()
 {
  $this-data['Post']['username'] = '';
  $this-data['Post']['password'] = '';
 }
 function logout()
 {
  $this-Session-destroy('user');
  $this-Session-setFlash('You\'ve successfully logged out.');
$this-redirect('index');
 }
*IV. Model*
function validateLogin($data)
{
$user = $this-find(array('username' = $data['username'],
'password' = $data['password']), array('id', 'username'));
if(empty($user) == false)
return $user['User'];
return false;
}


*Finally my error is,*


Notice (8): Undefined index:  username
[APP\controllers\posts_controller.php, line 60]

Code

if(empty($this-data) == false)

{

if(($user =
$this-Post-validateLogin($this-data['username'])) == true)

PostsController::login() - APP\controllers\posts_controller.php, line 60
Object::dispatchMethod() - CORE\cake\libs\object.php, line 115
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194
[main] - APP\webroot\index.php, line 88

Warning (512): SQL Error: 1054: Unknown column 'Post.username' in 'field
list' [CORE\cake\libs\model\datasources\dbo_source.php, line 525]

Code | Context

$sql = SELECT `Post`.`id`, `Post`.`username` FROM `posts` AS `Post`   WHERE
`username` IS NULL AND `password` IS NULLLIMIT 1
$error = 1054: Unknown column 'Post.username' in 'field list'
$out = null

$out = null;
if ($error) {
trigger_error(span style =
\color:Red;text-align:left\bSQL Error:/b
{$this-error}/span, E_USER_WARNING);

DboSource::showQuery() - CORE\cake\libs\model\datasources\dbo_source.php,
line 525
DboSource::execute() - CORE\cake\libs\model\datasources\dbo_source.php, line
201
DboSource::fetchAll() - CORE\cake\libs\model\datasources\dbo_source.php,
line 337
DboSource::read() - CORE\cake\libs\model\datasources\dbo_source.php, line
647
Model::find() - CORE\cake\libs\model\model.php, line 1963
Post::validateLogin() - APP\models\post.php, line 38
PostsController::login() - APP\controllers\posts_controller.php, line 60
Object::dispatchMethod() - CORE\cake\libs\object.php, line 115
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194
[main] - APP\webroot\index.php, line 88

Query: SELECT `Post`.`id`, `Post`.`username` FROM `posts` AS `Post`   WHERE
`username` IS NULL AND `password` IS NULLLIMIT



*Help me to solve this issue*
**
*How do i change the sq query to my table.*
**
*Regards,*
*Dhileepen*

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Login authentication

2009-07-17 Thread Amjad Farooq
I thinks you dont have use the variable that should be in controller like
$uses and $name which willl help to pick the table and controllers
hops it will work

On Fri, Jul 17, 2009 at 4:54 PM, Dhileepen Chakravarthy 
dhileepen.cake...@gmail.com wrote:

 Hi Everybody,

 *I. mysql db*
 users table with id username and password field.

 *II. index.ctp*
 div class=login
 h2Login/h2
 ?php echo $form-create('Post', array('action' = 'login'))?
 ?php echo $form-input('username');?
 ?php echo $form-input('password');?
 ?php echo $form-submit('Login');?
   ?php echo $form-button('Reset', array('type'='reset',
 'action'='clearLogin'));?
 ?php echo $form-end(); ?
 /div

 *III. posts_controller.php*
 function login()
  {
   if(empty($this-data) == false)
 {
 if(($user =
 $this-Post-validateLogin($this-data['username'])) == true)
 {
 $this-Session-write('Post', $user);
 $this-Session-setFlash('You\'ve successfully logged
 in.');
 $this-redirect('main');
 exit();
 }
 else
 {
 $this-Session-setFlash('Sorry, the information you\'ve
 entered is incorrect.');
 exit();
 }
 }
  }
  function clearLogin()
  {
   $this-data['Post']['username'] = '';
   $this-data['Post']['password'] = '';
  }
  function logout()
  {
   $this-Session-destroy('user');
   $this-Session-setFlash('You\'ve successfully logged out.');
 $this-redirect('index');
  }
 *IV. Model*
 function validateLogin($data)
 {
 $user = $this-find(array('username' = $data['username'],
 'password' = $data['password']), array('id', 'username'));
 if(empty($user) == false)
 return $user['User'];
 return false;
 }


 *Finally my error is,*


 Notice (8): Undefined index:  username
 [APP\controllers\posts_controller.php, line 60]

 Code

 if(empty($this-data) == false)

 {


 if(($user = $this-Post-validateLogin($this-data['username'])) 
 == true)

 PostsController::login() - APP\controllers\posts_controller.php, line 60
 Object::dispatchMethod() - CORE\cake\libs\object.php, line 115
 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227
 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194
 [main] - APP\webroot\index.php, line 88

 Warning (512): SQL Error: 1054: Unknown column 'Post.username' in 'field
 list' [CORE\cake\libs\model\datasources\dbo_source.php, line 525]

 Code | Context

 $sql = SELECT `Post`.`id`, `Post`.`username` FROM `posts` AS `Post`
 WHERE `username` IS NULL AND `password` IS NULLLIMIT 1
 $error = 1054: Unknown column 'Post.username' in 'field list'
 $out = null

 $out = null;
 if ($error) {

 trigger_error(span style = 
 \color:Red;text-align:left\bSQL Error:/b {$this-error}/span, 
 E_USER_WARNING);

 DboSource::showQuery() - CORE\cake\libs\model\datasources\dbo_source.php,
 line 525
 DboSource::execute() - CORE\cake\libs\model\datasources\dbo_source.php,
 line 201
 DboSource::fetchAll() - CORE\cake\libs\model\datasources\dbo_source.php,
 line 337
 DboSource::read() - CORE\cake\libs\model\datasources\dbo_source.php, line
 647
 Model::find() - CORE\cake\libs\model\model.php, line 1963
 Post::validateLogin() - APP\models\post.php, line 38
 PostsController::login() - APP\controllers\posts_controller.php, line 60
 Object::dispatchMethod() - CORE\cake\libs\object.php, line 115
 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227
 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194
 [main] - APP\webroot\index.php, line 88

 Query: SELECT `Post`.`id`, `Post`.`username` FROM `posts` AS `Post`   WHERE
 `username` IS NULL AND `password` IS NULLLIMIT



 *Help me to solve this issue*
 **
 *How do i change the sq query to my table.*
 **
 *Regards,*
 *Dhileepen*

 



-- 
Best Regard

Amjad Farooq
Web developer
Bramerz (Pvt)Ltd.
00923214239682

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Login authentication

2009-07-17 Thread Dhileepen Chakravarthy
Thanks for your reply. I am new for cakePHP. I find i did a mistake in

function validateLogin($data)
{
$user = $this-find(array('username' = $data['username'],
'password' = $data['password']), array('id', 'username'));
if(empty($user) == false)
return $user['User'];
return false;
}

how do i wrote my query in this function validateLogin()
select username from users where username = $data['username'] and
password=$data['password']

Regards,
Dhileepen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Login authentication

2009-07-17 Thread Andreas Derksen

Hi,
its much simpler, follow the steps on the cookbook.
http://book.cakephp.org/complete/172/Authentication

greets
Andreas


Dhileepen Chakravarthy schrieb:
 Thanks for your reply. I am new for cakePHP. I find i did a mistake in
  
 function validateLogin($data)
 {
 $user = $this-find(array('username' = $data['username'], 
 'password' = $data['password']), array('id', 'username'));
 if(empty($user) == false)
 return $user['User'];
 return false;
 }
  
 how do i wrote my query in this function validateLogin()
 select username from users where username = $data['username'] and 
 password=$data['password']
  
 Regards,
 Dhileepen
  
  

 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Login authentication

2009-07-17 Thread Thiago Elias
Hi Dhileepen,

I don't think you'll need to build your own query to validate.


function validateLogin($data)
{
$user = $this-find(array('username' = $data['username'],
'password' = $data['password']), array('id', 'username'));
if(empty($user) == false)
return $user['User'];
return false;
}


When I use find method, I like to pass all data like this: (assuming that
you just want id and username fields).

function validateLogin($data)
{
$user = $this-find('first',array(
'fields' = array('id', 'username'),
'conditions' = array('username = ' = $data['username'], 'password
= ' = $data['password']),
)
);

if(empty($user) == false)
return $user['User'];
return false;
}


In find method, I passed an associated array, with the fields and conditions
for my search. the 'first' argument means that I just want the first result.



Atenciosamente,
Thiago Elias.





2009/7/17 Andreas Derksen andreasderk...@arcor.de


 Hi,
 its much simpler, follow the steps on the cookbook.
 http://book.cakephp.org/complete/172/Authentication

 greets
 Andreas


 Dhileepen Chakravarthy schrieb:
  Thanks for your reply. I am new for cakePHP. I find i did a mistake in
 
  function validateLogin($data)
  {
  $user = $this-find(array('username' = $data['username'],
  'password' = $data['password']), array('id', 'username'));
  if(empty($user) == false)
  return $user['User'];
  return false;
  }
 
  how do i wrote my query in this function validateLogin()
  select username from users where username = $data['username'] and
  password=$data['password']
 
  Regards,
  Dhileepen
 
 
 
  

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---