Advertisement
Guest User

Untitled

a guest
Jan 24th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. class SecurityController extends Controller {
  2. /**
  3. * @Route("/login", name="login_form")
  4. */
  5. public function loginAction(Request $request) {
  6. $session = $request->getSession();
  7. // get the login error if there is one
  8. $error = $session->get(Security::AUTHENTICATION_ERROR);
  9. $session->remove(Security::AUTHENTICATION_ERROR);
  10.  
  11. return new JsonResponse($session);
  12. }
  13.  
  14. var cardCollectionControllers = angular.module('cardCollectionControllers');cardCollectionControllers.controller('LoginCtrl', ['$scope', '$http',
  15. function($scope, $http) {
  16. $scope.user = {};
  17. $scope.login = function() {
  18. $http({
  19. method : 'POST',
  20. url : 'http://localhost:8080/card_collection_backend/web/app_dev.php/login',
  21. data : encodeURIComponent('username=' + $scope.username +'&password=' + $scope.password),
  22. headers : {'Content-Type': 'application/x-www-form-urlencoded'}
  23. })
  24. .success(function(data) {
  25. //what to do here?
  26. });
  27. };}]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement