<commit_before>app.controller("loginController", 

	function($scope, Auth, $firebaseArray, $firebaseObject, $window) {


		$scope.input = {
			name: "",
			pwd: ""
		}

		Auth.$onAuthStateChanged(function(authData){
			//$scope.authData = authData;

			if (authData) {
				console.log(authData);
				$window.location.href = '/#/dashboard/home';
			}
			else console.log("signed out");
		});

		$scope.signedIn = function(){
			return $scope.authData != null;
		};

		$scope.login = function(){
			if ($scope.input.name != undefined && $scope.input.pwd != undefined){
				console.log('in');
				Auth.$signInWithEmailAndPassword(
					$scope.input.name,
					$scope.input.pwd
				).then(function(authData){
					console.log("Logged in as:", authData);
				}).catch(function(error){
					console.log("Authentication failed:", error);
					$window.alert(error);
				}, {remember: "sessionOnly"});			
			}	
			else{
				$window.alert("Missing required fields!");				
			}

		};

		$scope.logout = function(){
			Auth.$signOut().then(function(){
				console.log("Logged out");
			}).catch(function(error){
				console.log(error);
			});
		};

	}
);

app.controller("signupCtrl",

	function($scope, Auth, $firebaseArray, $firebaseObject, $window) {


		$scope.input = {
			email: "",
			name: "",
			pwd: ""
		}

		Auth.$onAuthStateChanged(function(authData){
			//$scope.authData = authData;

			if (authData) {
				console.log(authData);
				$window.location.href = '/#/dashboard/home';
			}
			else console.log("signed out");
		});


		$scope.register = function(){
			if ($scope.input.email != undefined && $scope.input.pwd != undefined && $scope.input.name != ""){
				Auth.$createUserWithEmailAndPassword($scope.input.email, $scope.input.pwd)
				.then(function(userData){
					console.log(userData.uid);
					var ref = firebase.database().ref("users/" + userData.uid + "/readOnly");
					var readonlyObj = $firebaseObject(ref);
					readonlyObj.email = userData.email;
					readonlyObj.name = $scope.input.name;
					readonlyObj.$save();


					// ref = firebase.database().ref("users/" + userData.uid + "/writable");
					// var wirteObj = $firebaseObject(ref);
					// wirteObj


					ref = firebase.database().ref("users/uidList");
					var uidlistObj = $firebaseArray(ref);
					uidlistObj.$add(userData.uid);


					ref = firebase.database().ref("users/nameList");
					var namelistObj = $firebaseArray(ref);
					var dict = {};
					dict[$scope.input.name] = userData.uid;										
					namelistObj.$add(dict);

				}).catch(function(error){
					$window.alert(error);
				});
			}
			else{<commit_msg>nameList changed<commit_after>app.controller("loginController", 

	function($scope, Auth, $firebaseArray, $firebaseObject, $window) {


		$scope.input = {
			name: "",
			pwd: ""
		}

		Auth.$onAuthStateChanged(function(authData){
			//$scope.authData = authData;

			if (authData) {
				console.log(authData);
				$window.location.href = '/#/dashboard/home';
			}
			else console.log("signed out");
		});

		$scope.signedIn = function(){
			return $scope.authData != null;
		};

		$scope.login = function(){
			if ($scope.input.name != undefined && $scope.input.pwd != undefined){
				console.log('in');
				Auth.$signInWithEmailAndPassword(
					$scope.input.name,
					$scope.input.pwd
				).then(function(authData){
					console.log("Logged in as:", authData);
				}).catch(function(error){
					console.log("Authentication failed:", error);
					$window.alert(error);
				}, {remember: "sessionOnly"});			
			}	
			else{
				$window.alert("Missing required fields!");				
			}

		};

		$scope.logout = function(){
			Auth.$signOut().then(function(){
				console.log("Logged out");
			}).catch(function(error){
				console.log(error);
			});
		};

	}
);

app.controller("signupCtrl",

	function($scope, Auth, $firebaseArray, $firebaseObject, $window) {


		$scope.input = {
			email: "",
			name: "",
			pwd: ""
		}

		Auth.$onAuthStateChanged(function(authData){
			//$scope.authData = authData;

			if (authData) {
				console.log(authData);
				$window.location.href = '/#/dashboard/home';
			}
			else console.log("signed out");
		});


		$scope.register = function(){
			if ($scope.input.email != undefined && $scope.input.pwd != undefined && $scope.input.name != ""){
				Auth.$createUserWithEmailAndPassword($scope.input.email, $scope.input.pwd)
				.then(function(userData){
					console.log(userData.uid);
					var ref = firebase.database().ref("users/" + userData.uid + "/readOnly");
					var readonlyObj = $firebaseObject(ref);
					readonlyObj.email = userData.email;
					readonlyObj.name = $scope.input.name;
					readonlyObj.$save();


					// ref = firebase.database().ref("users/" + userData.uid + "/writable");
					// var wirteObj = $firebaseObject(ref);
					// wirteObj


					ref = firebase.database().ref("users/uidList");
					var uidlistObj = $firebaseArray(ref);
					uidlistObj.$add(userData.uid);


					ref = firebase.database().ref("users/nameList");
					// var namelistObj = $firebaseObject(ref);
					var dict = {};
					dict[$scope.input.name] = userData.uid;		
					ref.update(dict);								
					// // namelistObj.$add(dict);

					// namelistObj[$scope.input.name] = userData.uid;
					// console.log(namelistObj);
					// namelistObj.$save();

				}).catch(function(error){
					$window.alert(error);
				});
			}
			else{
{'fraction_non_alphanumeric': 0.1836962590731435, 'fraction_numerical': 0.0, 'mean_word_length': 3.099160945842868, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5237384', 'n_tokens_mistral': 2259, 'n_tokens_neox': 1758, 'n_words': 269}