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,12 +199,12 @@ angular.module('confjuvapp.controllers', [])
199 $scope.data = {}; 199 $scope.data = {};
200 200
201 $scope.setLoginBasedOnEmail = function() { 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 // Function to register 205 // Function to register
206 $scope.Register = function(data) { 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 $ionicPopup.alert({ title: 'Registrar', template: 'Por favor preencha todos os campos' }); 208 $ionicPopup.alert({ title: 'Registrar', template: 'Por favor preencha todos os campos' });
209 return; 209 return;
210 } 210 }
@@ -212,7 +212,7 @@ angular.module('confjuvapp.controllers', []) @@ -212,7 +212,7 @@ angular.module('confjuvapp.controllers', [])
212 $ionicPopup.alert({ title: 'Registrar', template: 'Senhas não conferem' }); 212 $ionicPopup.alert({ title: 'Registrar', template: 'Senhas não conferem' });
213 return; 213 return;
214 } 214 }
215 - 215 +
216 $scope.loading = true; 216 $scope.loading = true;
217 217
218 var config = { 218 var config = {
@@ -223,7 +223,7 @@ angular.module('confjuvapp.controllers', []) @@ -223,7 +223,7 @@ angular.module('confjuvapp.controllers', [])
223 } 223 }
224 var params = { 224 var params = {
225 'email': data.email, 225 'email': data.email,
226 - 'login': data.login, 226 + 'login': data.login || ConfJuvAppUtils.normalizeLogin(data.email),
227 'password': data.password, 227 'password': data.password,
228 'password_confirmation': data.password_confirmation, 228 'password_confirmation': data.password_confirmation,
229 'tipo': $scope.registerFormType, 229 'tipo': $scope.registerFormType,