{"title":"DEMO | Страница входа в систему","template":"\u003cstyle\u003e\n .login-wrapper::before {\n /*z-index: 1;*/\n content: \" \";\n position: absolute;\n width: 100%;\n height: 100%;\n background: url(/restapi/getfile?code=images-2fb6d4f5-984d-4075-9328-7d86e3c85f09) 110% 120% no-repeat;\n background-size: 30% ;\n }\n .login-wrapper::after {\n /*z-index: 1;*/\n content: \" \";\n position: absolute;\n width: 100%;\n height: 100%;\n background: url(/restapi/getfile?code=images-2fb6d4f5-984d-4075-9328-7d86e3c85f09) -10% 40% no-repeat;\n background-size: 20% ;\n }\n\u003c/style\u003e\n\n\u003cdiv class=\"login-wrapper vw-100 vh-100 flex justify-content-center align-items-center\" \n style=\"\n background: linear-gradient(160deg, #04163288 0%, #041632ff 50%);\n background-size: 100% 100%;\n \"\u003e\n \n \n \u003cdiv class=\"mt-3 flex justify-content-center align-items-center z-3 relative\"\u003e\n \u003cdiv class=\"p-card auth shadow\" *ngIf=\"appComponent.params\"\u003e\n \u003cdiv class=\"p-card-body p-3\"\u003e\n \n \u003cdiv class=\"text-center m-4\"\u003e\n \u003cimg [src]=\"appComponent.params.angular_logo_2\" height=\"120px\" /\u003e\n \u003c/div\u003e\n \n \u003cp class=\"text-center\" translate\u003eИнформационная система электронного документооборота и автоматизации бизнес-процессов \"DamuBPM\"\u003c/p\u003e\n \n \u003cp-tabView\u003e\n \u003cp-tabPanel\u003e\n \u003cng-template pTemplate=\"header\"\u003e\n \u003cdiv class=\"text-center\" style=\"width: 180px\" translate=\"Логин\"\u003e\u003c/div\u003e\n \u003c/ng-template\u003e\n \n \u003cform [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\"\u003e\n \u003cng-container *ngIf=\"!is_expired_password\"\u003e\n \n \u003ch4 class=\"text-center\" translate=\"Авторизация\"\u003e\u003c/h4\u003e\n \u003cdiv class=\"mt-2 mb-3\"\u003e\n \n \u003c!--\u003clabel for=\"username\" translate\u003eUsername\u003c/label\u003e--\u003e\n \u003c!-- prefix=\"+7\" mask=\" (000) 000-00-00\" [showMaskTyped]=\"true\" --\u003e\n \u003cinput pInputText type=\"text\" formControlName=\"username\"\n [readonly]=\"is_expired_password\"\n class=\"w-100\"\n [ngClass]=\"{ 'is-invalid': submitted \u0026\u0026 f.username.errors }\"\n placeholder=\"{{ 'Insert Email' | translate }}\" id=\"username\"\n /\u003e\n \u003c/div\u003e\n \n \u003cdiv class=\"mt-2 mb-3\"\u003e\n \u003c!--\u003clabel translate for=\"password\"\u003ePassword\u003c/label\u003e--\u003e\n \u003cp-password\n formControlName=\"password\"\n [toggleMask]=\"true\"\n [readonly]=\"is_expired_password\"\n [placeholder]=\"'Insert Password' | translate\"\n [feedback]=\"false\"\n styleClass=\"w-100\"\n [ngClass]=\"{ 'is-invalid': service_error || (submitted \u0026\u0026 f.password.errors) }\"\n \u003e\u003c/p-password\u003e\n \u003c!--\u003cinput pInputText type=\"password\" formControlName=\"password\"--\u003e\n \u003c!-- [readonly]=\"is_expired_password\" placeholder=\"{{ 'Insert Password' | translate }}\"--\u003e\n \u003c!-- [ngClass]=\"{ 'is-invalid': service_error || (submitted \u0026\u0026 f.password.errors) }\" /\u003e--\u003e\n \n \u003c/div\u003e\n \n \u003cdiv class=\"invalid-feedback\"\u003e\n \u003cspan *ngIf=\"service_error\" [translate]=\"service_error\"\u003e\u003c/span\u003e\n \u003cspan *ngIf=\"submitted \u0026\u0026 f.username.errors?.required\" translate\u003eОбязательное поле\u003c/span\u003e\n \u003cspan *ngIf=\"submitted \u0026\u0026 f.password.errors?.required\" translate\u003ePassword is required\u003c/span\u003e\n \u003c/div\u003e\n \n \u003cp class=\"text-center\"\u003e\n \u003ca routerLink=\"/auth/forget\" class=\"small text-primary\"\u003e\n \u003cspan translate=\"Забыли пароль?\"\u003e\u003c/span\u003e\n \u003c/a\u003e\n \u003c/p\u003e\n \n \n \u003cp-button\n styleClass=\"my-3 p-button-outlined\"\n [label]=\"'Регистрация' | translate\"\n [style]=\"{width: '100%'}\"\n (click)=\"register()\" \n \u003e\u003c/p-button\u003e\n\n \n \u003c/ng-container\u003e\n \n \u003cng-container *ngIf=\"is_expired_password\"\u003e\n \u003ch4 class=\"text-center\" translate=\"Введите новый пароль\"\u003e\u003c/h4\u003e\n \n \u003cdiv class=\"mt-2 mb-3\"\u003e\n \u003c!--\u003clabel translate for=\"password\"\u003eNew Password\u003c/label\u003e--\u003e\n \u003c!--\u003cinput pInputText type=\"password\" formControlName=\"new_password\" minlength=\"8\"--\u003e\n \u003c!-- [placeholder]=\"'Insert Password' | translate\"--\u003e\n \u003c!-- [ngClass]=\"{ 'is-invalid': service_error_exp || (submitted \u0026\u0026 f.new_password.errors) }\" /\u003e--\u003e\n \n \u003cp-password\n formControlName=\"new_password\"\n [toggleMask]=\"true\"\n [placeholder]=\"'Insert Password' | translate\"\n [feedback]=\"false\"\n [ngClass]=\"{ 'is-invalid': service_error_exp || (submitted \u0026\u0026 f.new_password.errors) }\"\n \u003e\u003c/p-password\u003e\n \u003c/div\u003e\n \n \u003cdiv class=\"mt-2 mb-3\"\u003e\n \u003cp-password\n formControlName=\"password_confirm\"\n [toggleMask]=\"true\"\n [placeholder]=\"'Confirm Password' | translate\"\n [feedback]=\"false\"\n [ngClass]=\"{ 'is-invalid': service_error || (submitted \u0026\u0026 f.password_confirm.errors) }\"\n \u003e\u003c/p-password\u003e\n \u003c/div\u003e\n \u003c/ng-container\u003e\n \n \u003cbutton pButton [label]=\"'Sign In' | translate\" class=\"w-100\"\u003e\u003c/button\u003e\n \n \u003cdiv class=\"invalid-feedback\"\u003e\n \u003cspan *ngIf=\"service_error_exp\" [translate]=\"service_error_exp\"\u003e\u003c/span\u003e\n \u003cspan *ngIf=\"submitted \u0026\u0026 f.new_password.errors?.required\" translate\u003ePassword is required\u003c/span\u003e\n \u003cspan *ngIf=\"submitted \u0026\u0026 f.new_password.errors?.pattern\" translate\u003eMust contain at least one number and one uppercase and lowercase letter\u003c/span\u003e\n \u003cspan *ngIf=\"f.new_password.errors?.minlength\" translate\u003eMust contain at least 8 or more characters\u003c/span\u003e\n \u003cspan *ngIf=\"submitted \u0026\u0026 f.password_confirm.errors?.required\" translate\u003eConfirmed Password is required\u003c/span\u003e\n \u003cspan *ngIf=\"submitted \u0026\u0026 f.password_confirm.errors?.pattern\" translate\u003ePassword \u0026 Confirm Password does not match\u003c/span\u003e\n \u003c/div\u003e\n \u003c/form\u003e\n \u003c/p-tabPanel\u003e\n \u003cp-tabPanel\u003e\n \u003cng-template pTemplate=\"header\"\u003e\n \u003cdiv class=\"text-center\" style=\"width: 180px\" translate=\"Вход с ЭЦП\"\u003e\u003c/div\u003e\n \u003c/ng-template\u003e\n \n \u003ch4 class=\"text-center\" translate=\"Авторизация\"\u003e\u003c/h4\u003e\n \n \u003cp-button\n styleClass=\"my-3 p-button-outlined\"\n [label]=\"'Загрузить ключ ЭЦП' | translate\"\n [style]=\"{width: '100%'}\"\n (click)=\"enterByEds()\" \n \u003e\u003c/p-button\u003e\n \n \u003cp class=\"text-center small\"\u003e\n \u003ca href=\"https://pki.gov.kz/\" target=\"_blank\" class=\"text-primary\"\u003e\n \u003cspan translate=\"У меня нет ключа ЭЦП\"\u003e\u003c/span\u003e\n \u003c/a\u003e\n \u003c/p\u003e\n \n \u003c/p-tabPanel\u003e\n \u003c/p-tabView\u003e\n \n \u003cp class=\"p-text-description small text-center\"\u003eВерсия 1.9\u003c/p\u003e\n \n \n \n \n \n \u003c!--\u003cdiv class=\"flex justify-content-between\"\u003e--\u003e\n \u003c!-- \u003ca *ngIf=\"!with_eds\" routerLink=\"/auth/forget\" class=\"text-secondary\"\u003e--\u003e\n \u003c!-- \u003cspan translate=\"Забыли пароль?\"\u003e\u003c/span\u003e--\u003e\n \u003c!-- \u003c/a\u003e--\u003e\n \n \u003c!-- \u003ca *ngIf=\"with_eds\" href=\"https://pki.gov.kz/\" target=\"_blank\" class=\"text-secondary\"\u003e--\u003e\n \u003c!-- \u003cspan translate=\"У меня нет ключа ЭЦП\"\u003e\u003c/span\u003e--\u003e\n \u003c!-- \u003c/a\u003e--\u003e\n \n \u003c!-- \u003ca *ngIf=\"with_eds\" href=\"javascript:void(0);\" (click)=\"with_eds = false\" class=\"text-secondary\"\u003e--\u003e\n \u003c!-- \u003cspan translate=\"Вход по паролю\"\u003e\u003c/span\u003e--\u003e\n \u003c!-- \u003c/a\u003e--\u003e\n \n \u003c!-- \u003ca *ngIf=\"!with_eds\" href=\"javascript:void(0);\" (click)=\"with_eds = true\" class=\"text-secondary\"--\u003e\n \u003c!-- translate=\"Вход с ЭЦП\"\u003e\u003c/a\u003e--\u003e\n \u003c!--\u003ca routerLink=\"/auth/its_eo_register/reactivate\" class=\"text-secondary\"\u003e--\u003e\n \u003c!-- \u003cspan translate=\"Не пришло письмо активации\"\u003e\u003c/span\u003e--\u003e\n \u003c!--\u003c/a\u003e--\u003e\n \u003c!--\u003c/div\u003e--\u003e\n\n \u003c!--\u003cdiv class=\"mt-3\"\u003e--\u003e\n \u003c!-- \u003ca routerLink=\"/auth/its_abk_register\" class=\"text-secondary\"\u003e--\u003e\n \u003c!-- \u003cspan translate=\"Саморегистрация\"\u003e\u003c/span\u003e--\u003e\n \u003c!-- \u003c/a\u003e--\u003e\n \u003c!--\u003c/div\u003e--\u003e\n \u003c/div\u003e\n \u003c/div\u003e\n\u003c/div\u003e","json":"const vm = this;\n\nconst { FormControl, Validators } = forms;\n\nconst { take } = rxjs;\n\nreturn class GenClass extends vm.constructor {\n form;\n loading = false;\n submitted = false;\n is_expired_password = false;\n service_error = null;\n service_error_exp = \"\";\n with_eds = false;\n moment = moment;\n\n ngOnInit() {\n this.form = this.formBuilder.group({\n username: ['', Validators.required],\n password: ['', Validators.required],\n new_password: [''],\n password_confirm: ['']\n });\n }\n\n // convenience getter for easy access to form fields\n get f() { return this.form.controls; }\n\n onSubmit() {\n this.submitted = true;\n\n // reset alerts on submit\n this.alertService.clear();\n\n // stop here if form is invalid\n if (this.form.invalid) {\n return;\n }\n\n this.loading = true;\n\n if(this.is_expired_password) {\n this.accountService.resetExpiredPassword(this.f.username.value, this.f.password.value,this.f.new_password.value)\n .subscribe((resp)=\u003e{\n this.loading = false;\n if(resp['error_code'] != 0) {\n this.service_error_exp = resp.error_text;\n this.messageService.add({severity:'error', summary: 'Ошибка', detail: this.service_error_exp});\n this.submitted = false;\n } else {\n this.login(this.f.username.value, this.f.new_password.value);\n }\n });\n } else {\n this.login(this.f.username.value, this.f.password.value);\n }\n \n }\n \n enterByEds() {\n this.loading = true;\n this.submitted = true;\n\n this.edsService.connect(() =\u003e {\n \n this.messageService.add({severity:'warn', summary: 'Вниманиe', detail: 'Включите NCALayer'});\n this.loading = false;\n });\n \n this.edsService.xmlSignCallback = (xml) =\u003e {\n this.dbQueryService.restapiPost('its_eo_auth_by_eds',{ signxml: xml}).subscribe((resp) =\u003e {\n \n if(resp.error_code \u003e 0) {\n this.messageService.add({severity:'error', summary: 'Ошибка', detail: resp.error_text});\n this.service_error = resp.error_text;\n this.submitted = false;\n }\n \n if(resp.redirect_url) window.location.href = resp.redirect_url;\n console.log(resp);\n\n this.loading = false;\n this.edsService.disconnect();\n });\n }\n \n this.edsService.signXml(\"\u003croot\u003e\u003csign\u003e\u003clogin\u003e\" + new Date().toDateString() + \"\u003c/login\u003e\u003c/sign\u003e\u003c/root\u003e\",'AUTH')\n .subscribe(resp =\u003e {\n //console.log('signXml ===========\u003e', resp.responseObject);\n this.edsService.xmlSignCallback (resp.responseObject);\n });\n \n }\n\n loginCallBack = (data1) =\u003e {\n \n // console.log(data1,\"data1\");\n \n if(data1 \u0026\u0026 data1.output) {\n \n if (data1.output.last_error != \"\") {\n this.service_error = data1.output.last_error;\n this.submitted = false; \n this.messageService.add({severity:'error', summary: 'Ошибка', detail: data1.output.last_error});\n } else {\n // вызываем сервис с токеном, но не даем ему редиректить, далее проверяем сессию\n this.httpClient.get(data1.output.auth_url,{responseType: 'text'}).subscribe(resp =\u003e {\n this.accountService.setSessionValue(false);\n })\n \n }\n }\n \n }\n login_bp(username,password){\n this.appComponent.bpRun(\"login_by_sms\",{ login :username, password: password}, this.loginCallBack);\n }\n \n register(){\n window.location.href=\"/auth/its_samgau_register\"\n // this.appComponent.bpRun(\"its_register_by_email\", this.loginCallBack);\n }\n \n \n login(username,password) {\n this.accountService.login(username,password)\n .subscribe({\n next: resp =\u003e {\n this.loading = false;\n },\n error: (error) =\u003e {\n let resp = error.error;\n this.loading = false;\n if(resp[\"Result\"] == 'incorrect') {\n this.service_error = 'Имя пользователя или пароль неверны';\n } else if(resp[\"Result\"] == 'passwordExpired') {\n this.is_expired_password = true;\n this.service_error = 'Пароль истек';\n this.submitted = false;\n } else {\n this.service_error = 'Ошибка при проверке логина или пароля';\n }\n this.messageService.add({severity:'error', summary: 'Ошибка', detail: this.service_error});\n },\n complete: (resp) =\u003e {\n console.log('-=-=-=-=',resp);\n }\n });\n }\n}"}