<commit_before>angular.module("nh")
	.controller("LandingCtrl", [
		"$location",
		"$http",
		"apiUrl",
		function ($location, $http, apiUrl) {
			const landCtrl = this;
			landCtrl.isLoginVisible = false;
			landCtrl.isRegisterVisible = false;

			landCtrl.showLogin = function () {
				landCtrl.isRegisterVisible = false;
				landCtrl.isLoginVisible = true;
			}

			landCtrl.showRegister = function () {
				landCtrl.isLoginVisible = false;
				landCtrl.isRegisterVisible = true
			}

			landCtrl.login = function () {
				console.log("login");
				$http({
					url: `${apiUrl}/login/`,
					method: "POST",
					headers: {"Content-type": "application/x-www-form-encoded"},
					data: {
						"username": landCtrl.username,
						"password": <PASSWORD>
					}
				})
				.then((res) => {
					console.log("res: ", res);
					$location.path("/profile")})
				.catch((err) => console.log(err))
			};

			landCtrl.register = function (file) {
				let input = document.querySelector('[type="file"]');
				let image_file = input.files[0];

				let randomInteger = Math.random() * 1e17;
				let getFileExtension = image_file.type.split('/').slice(-1)[0];
				let randomPath = `${randomInteger}.${getFileExtension}`;

				firebase.storage().ref().child(randomPath).put(image_file)
					.then((res) => {
						$http({
							url: `${apiUrl}/register/`,
							method: "POST",
							headers: {"Content-type": "application/x-www-form-encoded"},
							data: {
								"username": landCtrl.userName,
								"password": <PASSWORD>,
								"first_name": landCtrl.firstName,
								"last_name": landCtrl.lastName,
								"email": landCtrl.email,
								"image": res.downloadURL,
								"user_type": landCtrl.user_type,
								"bio": landCtrl.bio
							}
						})
						.then((res) => {
							console.log("RES: ", res);
							$location.path("/profile")
						})
						.catch((err) => console.log(err))
					})
			}

			// landCtrl.register = function () {
			// 	console.log("register");

			// 	let input = document.querySelector('[type="file"]');
   //    			let file = input.files[0];
   //    			console.log("IMAGE: ", file);

			// 	$http({
			// 		url: `${apiUrl}/register/`,
			// 		method: "POST",
			// 		headers: {"Content-type": "application/x-www-form-encoded"},
			// 		data: {
			// 			"username": landCtrl.userName,
			// 			"password": <PASSWORD>,
			// 			"first_name": landCtrl.firstName,
			// 			"last_name": landCtrl.lastName,
			// 			"email": landCtrl.email,
			// 			"image": file,
			// 			"user_type": landCtrl.user_type,
			// 			"bio": landCtrl.bio
			// 		}
			// 	})
			// 	.then(() => $location.path("/profile"))
			// 	.catch((err) => console.log(err))
			// }
		}])<commit_msg>remove comments<commit_after>angular.module("nh")
	.controller("LandingCtrl", [
		"$location",
		"$http",
		"apiUrl",
		function ($location, $http, apiUrl) {
			const landCtrl = this;
			landCtrl.isLoginVisible = false;
			landCtrl.isRegisterVisible = false;

			landCtrl.showLogin = function () {
				landCtrl.isRegisterVisible = false;
				landCtrl.isLoginVisible = true;
			}

			landCtrl.showRegister = function () {
				landCtrl.isLoginVisible = false;
				landCtrl.isRegisterVisible = true
			}

			landCtrl.login = function () {
				console.log("login");
				$http({
					url: `${apiUrl}/login/`,
					method: "POST",
					headers: {"Content-type": "application/x-www-form-encoded"},
					data: {
						"username": landCtrl.username,
						"password": <PASSWORD>
					}
				})
				.then((res) => {
					console.log("res: ", res);
					$location.path("/profile")})
				.catch((err) => console.log(err))
			};

			landCtrl.register = function (file) {
				let input = document.querySelector('[type="file"]');
				let image_file = input.files[0];

				let randomInteger = Math.random() * 1e17;
				let getFileExtension = image_file.type.split('/').slice(-1)[0];
				let randomPath = `${randomInteger}.${getFileExtension}`;

				firebase.storage().ref().child(randomPath).put(image_file)
					.then((res) => {
						$http({
							url: `${apiUrl}/register/`,
							method: "POST",
							headers: {"Content-type": "application/x-www-form-encoded"},
							data: {
								"username": landCtrl.userName,
								"password": <PASSWORD>,
								"first_name": landCtrl.firstName,
								"last_name": landCtrl.lastName,
								"email": landCtrl.email,
								"image": res.downloadURL,
								"user_type": landCtrl.user_type,
								"bio": landCtrl.bio
							}
						})
						.then((res) => {
							console.log("RES: ", res);
							$location.path("/profile")
						})
						.catch((err) => console.log(err))
					})
			}
		}
	])
{'fraction_non_alphanumeric': 0.1866925064599483, 'fraction_numerical': 0.0027993109388458224, 'mean_word_length': 2.535007610350076, 'pattern_counts': {'":': 33, '<': 8, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 5, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6328893', 'n_tokens_mistral': 2092, 'n_tokens_neox': 1545, 'n_words': 245}