<commit_before>'use strict';

define(['angular'], function(angular) {

  var module = angular.module('admin.pages');

  var Controller = ['$scope', 'InitialUserResource', 'Notifications', '$location', 'Uri', function ($scope, InitialUserResource, Notifications, $location, Uri) {

    if (!/.*\/app\/admin\/(\w+)\/setup\/.*/.test($location.absUrl())) {
      $location.path("/");
      return;
    }

    $scope.engineName = Uri.appUri(':engine');

    // data model for user profile
    $scope.profile = {
      id : "",
      firstName : "",
      lastName : "",
      email : ""
    }

    // data model for credentials
    $scope.credentials = {
        password : "",
        password2 : ""
    };

    $scope.createUser = function() {
      var user = {
        profile : $scope.profile,
        credentials : { password : $scope.<PASSWORD> }
      };

      InitialUserResource.create(user).$then(
        function(){
          Notifications.addMessage({ type:"success", status:"Success", message:"Successfully created user. You can now login with user " + user.profile.id });
          $location.path("/users");
        },
        function(){
          Notifications.addError({ type:"error", status:"Error", message:"Could not create initial user." });
        }<commit_msg>impr(webapp): client side & cookie auth handling<commit_after>'use strict';

define(['angular'], function(angular) {

  var module = angular.module('admin.pages');

  var Controller = ['$scope', 'InitialUserResource', 'Notifications', '$location', 'Uri', function ($scope, InitialUserResource, Notifications, $location, Uri) {

    if (!/.*\/app\/admin\/(\w+)\/setup\/.*/.test($location.absUrl())) {
      $location.path("/");
      return;
    }

    $scope.engineName = Uri.appUri(':engine');

    // data model for user profile
    $scope.profile = {
      id : "",
      firstName : "",
      lastName : "",
      email : ""
    }

    // data model for credentials
    $scope.credentials = {
        password : "",
        password2 : ""
    };

    $scope.createUser = function() {
      var user = {
        profile : $scope.profile,
        credentials : { password : $scope.credentials.password }
      };

      InitialUserResource.create(user).$then(
        function(){
          // TODO: full page reload necessary?
          window.location = $location.absUrl().split("setup/#")[0];
        },
        function(){
          Notifications.addError({ type:"error", status:"Error", message:"Could not create initial user." });
        }
{'fraction_non_alphanumeric': 0.17398181099248716, 'fraction_numerical': 0.0011862396204033216, 'mean_word_length': 2.494475138121547, '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': '3478278', 'n_tokens_mistral': 714, 'n_tokens_neox': 689, 'n_words': 152}