<commit_before>'use strict';

angular.module('riwebApp')
  .controller('CreatebankCtrl', function ($scope) {
    $scope.bank = {};

    $scope.register = function (form) {
      $scope.submitted = true;

      if (form.$valid) {
        // Auth.createUser({
        //   name: $scope.user.name,
        //   email: $scope.user.email,
        //   password: <PASSWORD>,
        //   iban: $scope.user.iban,
        //   bank: $scope.user.bank._id
        // })
        //   .then(function () {
        //     // Account created, redirect to home
        //     $location.path('/myaccount');
        //   })
        //   .catch(function (err) {
        //     err = err.data;
        //     $scope.errors = {};

        //     // Update validity of form fields that match the mongoose errors
        //     angular.forEach(err.errors, function (error, field) {
        //       form[field].$setValidity('mongoose', false);
        //       $scope.errors[field] = error.message;
        //     });
        //   });
      }
    };
  });
 <commit_msg>createbank account goes to DB<commit_after>'use strict';

angular.module('riwebApp')
  .controller('CreatebankCtrl', function ($scope, $location, RiwebSocketService) {
    $scope.bank = {};

    $scope.register = function (form) {
      $scope.submitted = true;

      if (form.$valid) {
        RiwebSocketService.on('post:create_admin_user_for_bank', function (data) {
          if (data.status === 'success') {
            $scope.user = data.user;
            $location.path('/myaccount');
          }
        });

        RiwebSocketService.emit('create_bank', $scope.bank);
      }

    };
  });
 
{'fraction_non_alphanumeric': 0.16686893203883496, 'fraction_numerical': 0.0, 'mean_word_length': 1.76214405360134, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2550314', 'n_tokens_mistral': 503, 'n_tokens_neox': 492, 'n_words': 86}