This is a migrated thread and some comments may be shown as answers.

Everlive Register

2 Answers 52 Views
JavaScript SDK
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marcel
Top achievements
Rank 1
Marcel asked on 14 Mar 2016, 05:11 AM

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 Answers, 1 is accepted

Sort by
0
Marcel
Top achievements
Rank 1
answered on 14 Mar 2016, 02:05 PM
here is the error but it already let me register a new user
0
Martin
Telerik team
answered on 15 Mar 2016, 04:40 PM

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.
 
Tags
JavaScript SDK
Asked by
Marcel
Top achievements
Rank 1
Answers by
Marcel
Top achievements
Rank 1
Martin
Telerik team
Share this question
or