Everlive Register

3 posts, 0 answers
  1. Marcel
    Marcel avatar
    25 posts
    Member since:
    Mar 2015

    Posted 14 Mar Link to this post

    When I test the registration form on my app it register a user but shows an error saying " a user wit the say username already exist, try again", when going to the next page of my app.

     

    heres my code for register in service.js:

    register: function (registerData) {
                return el.Users.register(
                        registerData.username,
                        registerData.password,{
                            Email: registerData.email,
                        })
                    .then(function (data) {
                            return data;
                        },
                        function (error) {
                            return error;
                        });
            },

     

    heres my code for register in controller.js:

    $scope.registerData = {
            username: null,
            password: null,
          email: null
        };         
        
      
      // Perform the register action when the user submits the registration form
        $scope.doRegister = function () {
            User.register($scope.registerData).then(function (data) {
                if (data.result) {
                    //register me in
                   $scope.registerData.username;
                    $scope.registerData.password;
                    $state.go("app.home");
                    $scope.registermodal.hide();
                } else {
                    $ionicPopup.alert({
                        title: data.message,
                        template: 'Please try again!'
                    });
                }
            });
        };

  2. Marcel
    Marcel avatar
    25 posts
    Member since:
    Mar 2015

    Posted 14 Mar Link to this post

    here is the error but it already let me register a new user
  3. Martin
    Admin
    Martin avatar
    67 posts

    Posted 15 Mar Link to this post

    Hi Marcel,

    The provided register functions look OK. Still the sequence of events that you have described indicates that the register function is being called twice - the first time the request registers the user, the second  time the server returns the error "A user with the same username already exists."

    Please make sure that in the .html you are are not binding the doRegister() function twice. 

    Let me know if this has worked.


    Regards,
    Martin
    Telerik
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
Back to Top