{"size": 1267, "ext": "js", "max_stars_repo_path": "app/view/login/login.controller.js", "max_stars_repo_name": "sangwoongLee/church-attendance", "max_stars_repo_stars_event_min_datetime": "2019-05-31T00:41:07.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-25T03:45:25.000Z", "max_issues_repo_path": "app/view/login/login.controller.js", "max_issues_repo_name": "hanwool-chruch/church-attendance", "max_issues_repo_issues_event_min_datetime": "2019-06-04T06:01:37.000Z", "max_issues_repo_issues_event_max_datetime": "2020-02-14T02:41:04.000Z", "max_forks_repo_path": "app/view/login/login.controller.js", "max_forks_repo_name": "hanwool-chruch/church-attendance", "max_forks_repo_forks_event_min_datetime": "2020-12-12T13:55:52.000Z", "max_forks_repo_forks_event_max_datetime": "2020-12-12T13:57:00.000Z"}
{"max_stars_count": 3, "max_issues_count": 13, "max_forks_count": 2, "avg_line_length": 25.34, "max_line_length": 95, "alphanum_fraction": 0.5730071034}
﻿(function () {
    'use strict';

    angular
        .module('myApp')
        .controller('LoginController', LoginController);

    LoginController.$inject = ['$location', 'AuthenticationService', 'FlashService'];

    function LoginController($location, AuthenticationService, FlashService) {
			var vm = this;
			vm.login = login;
			vm.departments = [
				{text:'영아부', value:'1'},
				{text:'유아부', value:'2'},
				{text:'유치부', value:'3'},
				{text:'유년부', value:'4'},
				{text:'초등부', value:'5'},
				{text:'중등부', value:'6'},
				{text:'고등부', value:'7'},
				{text:'영어예배', value:'8'},
				{text:'청년부', value:'10'}
			];

			vm.authtypes = [
				{text:'관리자', value:'admin'},
				{text:'선생님', value:'teacher'}
			];

			(function initController() {
					// reset login status
					AuthenticationService.ClearCredentials();
			})();

			function login() {
					vm.dataLoading = true;
					AuthenticationService.Login(vm.department, vm.password, vm.authtype, function (response) {
							if (response.success) {
									AuthenticationService.SetCredentials(vm.department, vm.password, vm.authtype);
									$location.path('/main');
							} else {
									$.notify("사용자가 존재하지 않거나 암호가 틀립니다.");
									vm.dataLoading = false;
							}
					});
			};
    }

})();
