Created
June 25, 2012 11:23
-
-
Save ikwattro/2988040 to your computer and use it in GitHub Desktop.
Login form description in API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function logsinAction() | |
{ | |
$hypermedia = 'application/vnd.com.doggiiz.api+json'; | |
$data = array( | |
'message' => 'Welcome to the login page', | |
'self' => 'http://localhost/~ikwattro/devapp/app_dev.php/front/logsin', | |
'_links' => array( | |
'home' => array( | |
'href' => 'http://localhost/~ikwattro/devapp/app_dev.php/front/logsin', | |
'desc' => 'Return to home page' | |
) | |
), | |
'_actions' => array( | |
'login' => array( | |
'method' => 'POST', | |
'action' => 'http://localhost/~ikwattro/devapp/app_dev.php/front/logsin/verify', | |
'enctype' => null, | |
'fields' => array( | |
'username' => array( | |
'type' => 'text', | |
'required' => true, | |
'name' => 'doggiiz_form_login_username', | |
'label' => 'username' | |
), | |
'password' => array( | |
'type' => 'password', | |
'required' => true, | |
'name' => 'doggiiz_form_login_password', | |
'label' => 'password' | |
), | |
'firstname' => array( | |
'type' => 'text', | |
'required' => false, | |
'name' => 'doggiiz_form_login_firstname', | |
'label' => 'firstname' | |
), | |
'csrf' => array( | |
'type' => 'hidden', | |
'value' => 'fdsFDQSf56', | |
'required' => true, | |
'name' => 'doggiiz_form_login_csrf', | |
) | |
) | |
) | |
) | |
); | |
$json_data = json_encode($data); | |
$response = new Response($json_data, 200); | |
$response->headers->set('Content-Type', $hypermedia); | |
return $response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment