Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- auth.controller('register', ['$scope','$http','$timeout','$location', function($scope,$http,$timeout,$location){
- $scope.register = function () {
- let input = $scope.input;
- input.password = $scope.input.password1;
- if (input.password1 !== input.password2){
- $scope.message = 'Podane hasła się nie zgadzają'
- }
- else if (input.name && input.surrname){
- $scope.message = 'Wypełnij wszystkie pola'
- }
- else{
- $http.post('/api/crete-user',input).then(function(response){
- $scope.message = response.data;
- $timeout(function() { $location.path("/");}, 3000);
- }),function(){
- $scope.message = 'Nieoczekiwany błąd'
- };
- }
- }
- }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement