/**
|
* Created by wisestone on 2018-04-02.
|
*/
|
'use strict';
|
|
define([
|
'app',
|
'angular'
|
],
|
function (app) {
|
app.controller('userPasswordController', ['$scope', '$rootScope', '$log', '$resourceProvider', 'User', '$uibModalInstance', 'SweetAlert', '$filter',
|
function ($scope, $rootScope, $log, $resourceProvider, User, $uibModalInstance, SweetAlert, $filter) {
|
|
$scope.fn = {
|
cancel : cancel, // 팝업창 닫기
|
formCheck : formCheck, // 폼 체크
|
formSubmit : formSubmit // 폼 전송
|
};
|
|
$scope.vm = {
|
form : {
|
account : ""
|
}
|
};
|
|
// 폼 체크
|
function formCheck(formInvalid) {
|
if (formInvalid) {
|
return true;
|
}
|
|
return false;
|
}
|
|
// 폼 전송
|
function formSubmit() {
|
$rootScope.spinner = true;
|
|
var content = {
|
account : $rootScope.encryption($scope.vm.form.account)
|
};
|
|
User.returnEmailPassword($resourceProvider.getContent(
|
content,
|
$resourceProvider.getPageContent(0, 10))).then(function (result) {
|
|
if (result.data.message.status === "success") {
|
SweetAlert.success($filter("translate")("users.temporaryPasswordIssue"), result.data.message.message); // "임시 비밀번호 발급"
|
$scope.fn.cancel();
|
}
|
else {
|
SweetAlert.error($filter("translate")("users.failedRequestFindPassword"), result.data.message.message); // "비밀번호 찾기 요청 실패"
|
}
|
|
$rootScope.spinner = false;
|
});
|
}
|
|
function cancel() {
|
$rootScope.$broadcast("closeLayer"); // 팝업이 열리고 나서 js-multi, js-single 등에서 body 이벤트가 날아가는 현상 수정
|
$uibModalInstance.dismiss('cancel');
|
$(document).unbind("keydown"); // 단축키 이벤트 제거
|
}
|
|
}]);
|
});
|