Commit 7e4089427bedbc7551afeb5d3a2df09e16815553

Authored by Caio Almeida
1 parent 7562257e

Fixing register

Showing 1 changed file with 4 additions and 4 deletions   Show diff stats
www/js/controllers.js
... ... @@ -199,12 +199,12 @@ angular.module('confjuvapp.controllers', [])
199 199 $scope.data = {};
200 200  
201 201 $scope.setLoginBasedOnEmail = function() {
202   - if (!$scope.profile.login && $scope.profile.email) $scope.profile.login = ConfJuvAppUtils.normalizeLogin($scope.profile.email);
  202 + // if (!$scope.profile.login && $scope.profile.email) $scope.profile.login = ConfJuvAppUtils.normalizeLogin($scope.profile.email);
203 203 };
204 204  
205 205 // Function to register
206 206 $scope.Register = function(data) {
207   - if (!data || !data.login || !data.email || !data.password || !data.password_confirmation) {
  207 + if (!data || !data.email || !data.password || !data.password_confirmation) {
208 208 $ionicPopup.alert({ title: 'Registrar', template: 'Por favor preencha todos os campos' });
209 209 return;
210 210 }
... ... @@ -212,7 +212,7 @@ angular.module('confjuvapp.controllers', [])
212 212 $ionicPopup.alert({ title: 'Registrar', template: 'Senhas não conferem' });
213 213 return;
214 214 }
215   -
  215 +
216 216 $scope.loading = true;
217 217  
218 218 var config = {
... ... @@ -223,7 +223,7 @@ angular.module('confjuvapp.controllers', [])
223 223 }
224 224 var params = {
225 225 'email': data.email,
226   - 'login': data.login,
  226 + 'login': data.login || ConfJuvAppUtils.normalizeLogin(data.email),
227 227 'password': data.password,
228 228 'password_confirmation': data.password_confirmation,
229 229 'tipo': $scope.registerFormType,
... ...