Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $scope.addUser = function () {
- $scope.userData = {
- email: $scope.user.email,
- password: $scope.user.password
- };
- auth.signup($scope.userData, successAuth, function (error) {
- $rootScope.error = error;
- });
- };
- myApp.service('auth', function($http){
- return {
- signup: function(data,success, error){
- //API call to save new user
- $http.post('mvc-dispatcher/registration', data).success(success).error(error);
- }
- };
- });
- @RestController
- public class UserController {
- @Autowired
- private UserService userService;
- @Autowired
- private SecurityService securityService;
- @Autowired
- private UserValidator userValidator;
- @RequestMapping(value = "/registration", consumes = "application/json", headers = "content-type=application/x-www-form-urlencoded")
- public void registration(@RequestBody User userBean) {
- User myUser = new User();
- System.out.println("register");
- System.out.println("name: " + userBean.getUsername());
- userService.saveUser(userBean); // how to save user here?
- }
- }
- //user repository
- public interface UserRepository extends JpaRepository<User, Long> {
- User findByUsername(String username);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement