Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.08 KB | None | 0 0
  1. $builder
  2. ->add('username', TextType::class , array(
  3. 'label' => false,
  4. 'attr' => array(
  5. 'ng-model' => 'formData.username',
  6. 'id' => 'usernamesignup',
  7. 'placeholder' => 'myusername690',
  8. 'required' => false)
  9. ))
  10. ->add('email', TextType::class , array(
  11. 'label' => false,
  12. 'attr' => array(
  13. 'ng-model' => 'formData.email',
  14. 'id' => 'emailsignup',
  15. 'placeholder' => 'mymail@mail.com',
  16. 'ng-pattern' => '/^([0-9a-zA-Z]([-.w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-w]*[0-9a-zA-Z].)+[a-zA-Z]{2,9})$/',
  17. 'required' => false)
  18. ))
  19. ->add('plainPassword', RepeatedType::class, array(
  20. 'type' => PasswordType::class,
  21. 'first_options' => array(
  22. 'label' => false,
  23. 'attr' => array(
  24. 'ng-model' => 'formData.password',
  25. 'id' => 'passwordsignup',
  26. 'placeholder' => 'eg. X8df!90EO',
  27. 'required' => false)
  28. ),
  29. 'second_options' => array('label' => false,
  30. 'attr' => array(
  31. 'ng-model' => 'formData.confirm_password',
  32. 'id' => 'passwordsignup_confirm',
  33. 'placeholder' => 'eg. X8df!90EO',
  34. 'required' => false)
  35. ),
  36. )
  37. );
  38.  
  39. <body ng-app="LoginApp">
  40. <div id="register" class="animate form" ng-controller="RegisterController as registerCtrl">
  41. {{ form_start(form, {'attr': {'name':'registerFrm', 'id':'registerFrmId', 'novalidate': '', 'ng-submit':'registerCtrl.registerFrm()'}}) }}
  42. Your username
  43. {{ form_row(form.username) }}
  44. <span class="error" ng-show="submitted && registerFrm.adminuser[username].$error.required">Username is required!</span>
  45.  
  46. Your email
  47. {{ form_row(form.email) }}
  48. <span class="error" ng-show="submitted && registerFrm.adminuser[email].$invalid">Invalid email</span>
  49.  
  50. Your password
  51. {{ form_row(form.plainPassword.first) }}
  52. <span class="error" ng-show="submitted && registerFrm.adminuser[plainPassword][first].$error.required">Password is required!</span>
  53.  
  54. Please confirm your password
  55. {{ form_row(form.plainPassword.second) }}
  56. <span class="error" ng-show="submitted && registerFrm.adminuser[plainPassword][second].$error.required">Password is required!</span>
  57.  
  58. <p class="signin button">
  59. <input type="submit" name="signup" ng-model="signup" ng-click="submitted=true" value="Sign up" />
  60. </p>
  61. {{ form_end(form) }}
  62. </div>
  63.  
  64. <script>
  65. var App = angular.module('LoginApp',[]);
  66.  
  67. App.controller('RegisterController', ['$scope','$http',function($scope,$http) {
  68. //$scope.formData = {};
  69. this.registerFrm = function() {
  70. var encodedString = $.param($scope.formData);
  71.  
  72. console.log(encodedString);
  73. $http({
  74. method: 'POST',
  75. url: 'login',
  76. data: encodedString,
  77. headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  78. })
  79. .success(function(data, status, headers, config) {
  80. console.log(data);
  81. })
  82. .error(function(data, status, headers, config) {
  83. $scope.errorMsg = 'Unable to submit form';
  84. })
  85. }
  86. }]);
  87. </script>
  88. </body>
  89.  
  90. adminuser[username]=tecnily&adminuser[email]=krebinj%40gmail.com&adminuser[password]=654321&adminuser[confirm_password]=654321&adminuser[signup]=signup
  91.  
  92. $user = new User();
  93. echo '<pre>';print_r($user);exit;
  94.  
  95. <pre>AppBundleEntityUser Object
  96. (
  97. [username:AppBundleEntityUser:private] =>
  98. [email:AppBundleEntityUser:private] =>
  99. [password:AppBundleEntityUser:private] =>
  100. [plainPassword:AppBundleEntityUser:private] =>
  101. [createDate:AppBundleEntityUser:private] =>
  102. [id:AppBundleEntityUser:private] =>
  103. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement