The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled PHP Code
Posted by: ajax login | February 5, 2011 @ 11:36pm
PHP Code
[
Download
]
/* AJAX CODE */ $.ajax({ type: "POST", data: {'data':{ 'User':{ 'email': email, 'password': password } }}, url: baseUrl+"/users/login", success: function(result) { console.log(result); } }); /* users_controller.php */ function login() { if($this->RequestHandler->isAjax() == true) { if ($this->Session->check('Auth.User')) { echo "true"; } else { echo json_encode($this->data); } $this->render(null,'ajax'); exit; } function beforeFilter() { parent::beforeFilter(); $this->Auth->fields = array('username' => 'email', 'password' => 'password'); }
Syntax Highlighting
[
Open in new window
]
Author Comments
I always get json_encode($this->data) back, which contains the right information including the hashed password, but it never logs in
Rating
4.42 / 8
52 Votes
http://codebin.yi.org/1094
page generated in 0.01 seconds