ge-admin-auth.umd.js 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('@nebular/auth'), require('@ngx-translate/core'), require('@nebular/theme'), require('@angular/forms'), require('rxjs'), require('rxjs/operators'), require('@angular/common/http'), require('jsencrypt')) :
  3. typeof define === 'function' && define.amd ? define('ge-admin-auth', ['exports', '@angular/core', '@angular/common', '@angular/router', '@nebular/auth', '@ngx-translate/core', '@nebular/theme', '@angular/forms', 'rxjs', 'rxjs/operators', '@angular/common/http', 'jsencrypt'], factory) :
  4. (global = global || self, factory(global['ge-admin-auth'] = {}, global.ng.core, global.ng.common, global.ng.router, global.auth, global.core$1, global.theme, global.ng.forms, global.rxjs, global.rxjs.operators, global.ng.common.http, global.jsencrypt));
  5. }(this, (function (exports, core, common, router, auth, core$1, theme, forms, rxjs, operators, http, jsencrypt) { 'use strict';
  6. /*! *****************************************************************************
  7. Copyright (c) Microsoft Corporation. All rights reserved.
  8. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  9. this file except in compliance with the License. You may obtain a copy of the
  10. License at http://www.apache.org/licenses/LICENSE-2.0
  11. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  12. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  13. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  14. MERCHANTABLITY OR NON-INFRINGEMENT.
  15. See the Apache Version 2.0 License for specific language governing permissions
  16. and limitations under the License.
  17. ***************************************************************************** */
  18. /* global Reflect, Promise */
  19. var extendStatics = function(d, b) {
  20. extendStatics = Object.setPrototypeOf ||
  21. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  22. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  23. return extendStatics(d, b);
  24. };
  25. function __extends(d, b) {
  26. extendStatics(d, b);
  27. function __() { this.constructor = d; }
  28. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  29. }
  30. function __values(o) {
  31. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  32. if (m) return m.call(o);
  33. if (o && typeof o.length === "number") return {
  34. next: function () {
  35. if (o && i >= o.length) o = void 0;
  36. return { value: o && o[i++], done: !o };
  37. }
  38. };
  39. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  40. }
  41. /**
  42. * @fileoverview added by tsickle
  43. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  44. */
  45. /** @type {?} */
  46. var lang = {
  47. '与第一次输入不符合': '与第一次输入不符合.',
  48. '修改密码': '修改密码',
  49. '密码': '密码',
  50. '密码:': '密码:',
  51. '密码是必填的': '密码是必填的',
  52. '密码规则提示': '密码应该包含 最小长度 {{minLength}} 最大长度 {{maxLength}} 个字符',
  53. '您好,欢迎使用': '您好,欢迎使用',
  54. '成功!': '成功!',
  55. '新密码': '新密码',
  56. '新密码:': '新密码:',
  57. '新密码是必填的!': '新密码是必填的!',
  58. '旧密码:': '旧密码:',
  59. '旧密码是必填的!': '旧密码是必填的',
  60. '登出提示': '正在登出, 请等待...',
  61. '登录': '登录',
  62. '确认密码': '确认密码',
  63. '确认密码:': '确认密码:',
  64. '确认密码是必填的!': '确认密码是必填的!',
  65. '请设置您的新密码': '请设置您的新密码',
  66. '账户': '账户',
  67. '账户:': '账户:',
  68. '账户是必填的': '账户是必填的',
  69. '错误!': '错误!'
  70. };
  71. /**
  72. * @fileoverview added by tsickle
  73. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  74. */
  75. /** @type {?} */
  76. var lang$1 = {
  77. '与第一次输入不符合': '與第一次輸入不符合.',
  78. '修改密码': '更改密碼',
  79. '密码': '密碼',
  80. '密码:': '密碼:',
  81. '密码是必填的': '必須填寫密碼',
  82. '密码规则提示': '密碼應該包含 最小長度 {{minLength}} 最大長度 {{maxLength}} 個字符',
  83. '您好,欢迎使用': '您好,歡迎使用',
  84. '成功!': '成功!',
  85. '新密码': '新密碼',
  86. '新密码:': '新密碼:',
  87. '新密码是必填的!': '必須填寫新密碼',
  88. '旧密码:': '舊密碼:',
  89. '旧密码是必填的!': '必須填寫舊密碼',
  90. '登出提示': '正在登出, 請稍候⋯',
  91. '登录': '登入',
  92. '确认密码': '確認密碼',
  93. '确认密码:': '確認密碼:',
  94. '确认密码是必填的!': '必須填寫確認密碼',
  95. '请设置您的新密码': '請設置您的新密碼',
  96. '账户': '賬戶',
  97. '账户:': '賬戶:',
  98. '账户是必填的': '必須填寫賬戶',
  99. '错误!': '錯誤!'
  100. };
  101. /**
  102. * @fileoverview added by tsickle
  103. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  104. */
  105. /** @type {?} */
  106. var AUTH_DEFAULT_LANG = new core.InjectionToken('AUTH_DEFAULT_LANG');
  107. var LoginLangService = /** @class */ (function () {
  108. function LoginLangService(_translate, lang$2) {
  109. this._translate = _translate;
  110. this._translate.setTranslation('zh-cn', lang);
  111. this._translate.setTranslation('zh-hk', lang$1);
  112. this._translate.setDefaultLang(lang$2 ? lang$2 : 'zh-cn');
  113. this._translate.use(lang$2 ? lang$2 : 'zh-cn');
  114. }
  115. /**
  116. * @param {?=} lang
  117. * @return {?}
  118. */
  119. LoginLangService.prototype.setTranslate = /**
  120. * @param {?=} lang
  121. * @return {?}
  122. */
  123. function (lang) {
  124. this._translate.use(lang);
  125. };
  126. LoginLangService.decorators = [
  127. { type: core.Injectable }
  128. ];
  129. /** @nocollapse */
  130. LoginLangService.ctorParameters = function () { return [
  131. { type: core$1.TranslateService },
  132. { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [AUTH_DEFAULT_LANG,] }] }
  133. ]; };
  134. return LoginLangService;
  135. }());
  136. /**
  137. * @fileoverview added by tsickle
  138. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  139. */
  140. // getDeepFromObject({result: {data: 1}}, 'result.data', 2); // returns 1
  141. /**
  142. * @param {?=} object
  143. * @param {?=} name
  144. * @param {?=} defaultValue
  145. * @return {?}
  146. */
  147. function getDeepFromObject(object, name, defaultValue) {
  148. var e_1, _a;
  149. if (object === void 0) { object = {}; }
  150. /** @type {?} */
  151. var keys = name.split('.');
  152. // clone the object
  153. /** @type {?} */
  154. var currentValue = object;
  155. try {
  156. for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
  157. var key = keys_1_1.value;
  158. if (currentValue) {
  159. currentValue = currentValue[key];
  160. }
  161. else {
  162. break;
  163. }
  164. }
  165. }
  166. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  167. finally {
  168. try {
  169. if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
  170. }
  171. finally { if (e_1) throw e_1.error; }
  172. }
  173. return typeof currentValue === 'undefined' ? defaultValue : currentValue;
  174. }
  175. /**
  176. * @fileoverview added by tsickle
  177. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  178. */
  179. var LoginComponent = /** @class */ (function () {
  180. function LoginComponent(service, langService, options, cd, router) {
  181. if (options === void 0) { options = {}; }
  182. this.service = service;
  183. this.langService = langService;
  184. this.options = options;
  185. this.cd = cd;
  186. this.router = router;
  187. this.redirectDelay = 0;
  188. this.showMessages = {};
  189. this.strategy = '';
  190. this.errors = [];
  191. this.messages = [];
  192. this.user = {};
  193. this.submitted = false;
  194. this.socialLinks = [];
  195. this.rememberMe = false;
  196. this.redirectDelay = this.getConfigValue('forms.login.redirectDelay');
  197. this.showMessages = this.getConfigValue('forms.login.showMessages');
  198. this.strategy = this.getConfigValue('forms.login.strategy');
  199. this.socialLinks = this.getConfigValue('forms.login.socialLinks');
  200. this.rememberMe = this.getConfigValue('forms.login.rememberMe');
  201. }
  202. /**
  203. * @return {?}
  204. */
  205. LoginComponent.prototype.login = /**
  206. * @return {?}
  207. */
  208. function () {
  209. var _this = this;
  210. this.errors = [];
  211. this.messages = [];
  212. this.submitted = true;
  213. this.service.authenticate(this.strategy, this.user).subscribe((/**
  214. * @param {?} result
  215. * @return {?}
  216. */
  217. function (result) {
  218. _this.submitted = false;
  219. if (result.isSuccess()) {
  220. _this.messages = result.getMessages();
  221. }
  222. else {
  223. _this.errors = result.getErrors();
  224. }
  225. /** @type {?} */
  226. var redirect = result.getRedirect();
  227. if (redirect) {
  228. setTimeout((/**
  229. * @return {?}
  230. */
  231. function () {
  232. return _this.router.navigateByUrl(redirect);
  233. }), _this.redirectDelay);
  234. }
  235. _this.cd.detectChanges();
  236. }));
  237. };
  238. /**
  239. * @param {?} key
  240. * @return {?}
  241. */
  242. LoginComponent.prototype.getConfigValue = /**
  243. * @param {?} key
  244. * @return {?}
  245. */
  246. function (key) {
  247. return getDeepFromObject(this.options, key, null);
  248. };
  249. LoginComponent.decorators = [
  250. { type: core.Component, args: [{
  251. selector: 'auth-login',
  252. template: "<h1 id=\"title\" class=\"title\" translate>\u767B\u5F55</h1>\r\n<p class=\"sub-title\" translate>\u60A8\u597D,\u6B22\u8FCE\u4F7F\u7528</p>\r\n\r\n<nb-alert *ngIf=\"showMessages.error && errors?.length && !submitted\" outline=\"danger\" role=\"alert\">\r\n <p class=\"alert-title\"><b translate>\u9519\u8BEF!</b></p>\r\n <ul class=\"alert-message-list\">\r\n <li *ngFor=\"let error of errors\" class=\"alert-message\">{{ error }}</li>\r\n </ul>\r\n</nb-alert>\r\n\r\n<nb-alert\r\n *ngIf=\"showMessages.success && messages?.length && !submitted\"\r\n outline=\"success\"\r\n role=\"alert\"\r\n>\r\n <p class=\"alert-title\"><b translate>\u6210\u529F!</b></p>\r\n <ul class=\"alert-message-list\">\r\n <li *ngFor=\"let message of messages\" class=\"alert-message\">{{ message }}</li>\r\n </ul>\r\n</nb-alert>\r\n\r\n<form (ngSubmit)=\"login()\" #form=\"ngForm\" aria-labelledby=\"title\">\r\n <div class=\"form-control-group\">\r\n <label class=\"label\" for=\"input-email\" translate>\u8D26\u6237:</label>\r\n <input\r\n nbInput\r\n fullWidth\r\n [(ngModel)]=\"user.loginId\"\r\n #loginId=\"ngModel\"\r\n name=\"loginId\"\r\n id=\"input-loginId\"\r\n placeholder=\"{{ '\u8D26\u6237' | translate }}\"\r\n autofocus\r\n [status]=\"loginId.dirty ? (loginId.invalid ? 'danger' : 'success') : ''\"\r\n [required]=\"true\"\r\n [attr.aria-invalid]=\"loginId.invalid && loginId.touched ? true : null\"\r\n />\r\n <ng-container *ngIf=\"loginId.invalid && loginId.touched\">\r\n <p class=\"error-message\" *ngIf=\"loginId.errors?.required\" translate=\"\u8D26\u6237\u662F\u5FC5\u586B\u7684\">\r\n\r\n </p>\r\n </ng-container>\r\n </div>\r\n\r\n <div class=\"form-control-group\">\r\n <label class=\"label\" for=\"input-password\" translate>\u5BC6\u7801:</label>\r\n <input\r\n nbInput\r\n fullWidth\r\n [(ngModel)]=\"user.loginPassword\"\r\n #password=\"ngModel\"\r\n name=\"password\"\r\n type=\"password\"\r\n id=\"input-password\"\r\n placeholder=\"{{'\u5BC6\u7801'|translate}}\"\r\n [status]=\"password.dirty ? (password.invalid ? 'danger' : 'success') : ''\"\r\n [required]=\"true\"\r\n [minlength]=\"getConfigValue('forms.validation.password.minLength')\"\r\n [maxlength]=\"getConfigValue('forms.validation.password.maxLength')\"\r\n [attr.aria-invalid]=\"password.invalid && password.touched ? true : null\"\r\n />\r\n <ng-container *ngIf=\"password.invalid && password.touched\">\r\n <p class=\"error-message\" *ngIf=\"password.errors?.required\" translate=\"\u5BC6\u7801\u662F\u5FC5\u586B\u7684\">\r\n\r\n </p>\r\n <p class=\"error-message\" *ngIf=\"password.errors?.minlength || password.errors?.maxlength\"\r\n translate=\"\u5BC6\u7801\u89C4\u5219\u63D0\u793A\" [translateParams]=\"{minLength: getConfigValue('forms.validation.password.minLength'), maxLength:getConfigValue('forms.validation.password.maxLength')}\"\r\n >\r\n \u5BC6\u7801\u5E94\u8BE5\u5305\u542B \u6700\u5C0F\u957F\u5EA6 {{ getConfigValue('forms.validation.password.minLength') }} \u6700\u5927\u957F\u5EA6\r\n {{ getConfigValue('forms.validation.password.maxLength') }}\r\n \u4E2A\u5B57\u7B26\r\n </p>\r\n </ng-container>\r\n </div>\r\n\r\n <!--<div class=\"form-control-group accept-group\">-->\r\n <!--<nb-checkbox name=\"rememberMe\" [(ngModel)]=\"user.rememberMe\" *ngIf=\"rememberMe\">\u8BB0\u4F4F\u8D26\u53F7</nb-checkbox>-->\r\n <!--&lt;!&ndash;<a class=\"forgot-password\" routerLink=\"../request-password\">Forgot Password?</a>&ndash;&gt;-->\r\n <!--</div>-->\r\n\r\n <button\r\n nbButton\r\n fullWidth\r\n status=\"success\"\r\n [disabled]=\"submitted || !form.valid\"\r\n [class.btn-pulse]=\"submitted\"\r\n translate=\"\u767B\u5F55\"\r\n >\r\n </button>\r\n</form>\r\n\r\n<!--<section *ngIf=\"socialLinks && socialLinks.length > 0\" class=\"links\" aria-label=\"Social sign in\">-->\r\n<!--or enter with:-->\r\n<!--<div class=\"socials\">-->\r\n<!--<ng-container *ngFor=\"let socialLink of socialLinks\">-->\r\n<!--<a *ngIf=\"socialLink.link\"-->\r\n<!--[routerLink]=\"socialLink.link\"-->\r\n<!--[attr.target]=\"socialLink.target\"-->\r\n<!--[attr.class]=\"socialLink.icon\"-->\r\n<!--[class.with-icon]=\"socialLink.icon\">{{ socialLink.title }}</a>-->\r\n<!--<a *ngIf=\"socialLink.url\"-->\r\n<!--[attr.href]=\"socialLink.url\"-->\r\n<!--[attr.target]=\"socialLink.target\"-->\r\n<!--[attr.class]=\"socialLink.icon\"-->\r\n<!--[class.with-icon]=\"socialLink.icon\">{{ socialLink.title }}</a>-->\r\n<!--</ng-container>-->\r\n<!--</div>-->\r\n<!--</section>-->\r\n\r\n<!--<section class=\"another-action\" aria-label=\"Register\">-->\r\n<!--Don't have an account? <a class=\"text-link\" routerLink=\"../register\">Register</a>-->\r\n<!--</section>-->\r\n",
  253. changeDetection: core.ChangeDetectionStrategy.OnPush
  254. }] }
  255. ];
  256. /** @nocollapse */
  257. LoginComponent.ctorParameters = function () { return [
  258. { type: auth.NbAuthService },
  259. { type: LoginLangService },
  260. { type: undefined, decorators: [{ type: core.Inject, args: [auth.NB_AUTH_OPTIONS,] }] },
  261. { type: core.ChangeDetectorRef },
  262. { type: router.Router }
  263. ]; };
  264. return LoginComponent;
  265. }());
  266. /**
  267. * @fileoverview added by tsickle
  268. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  269. */
  270. var NamePasswordAuthStrategyOptions = /** @class */ (function (_super) {
  271. __extends(NamePasswordAuthStrategyOptions, _super);
  272. function NamePasswordAuthStrategyOptions() {
  273. var _this = _super !== null && _super.apply(this, arguments) || this;
  274. _this.baseEndpoint = '/api/auth/';
  275. _this.getPublicKey = {
  276. endpoint: 'getPublicKey',
  277. method: 'get'
  278. };
  279. _this.login = {
  280. alwaysFail: false,
  281. endpoint: 'login',
  282. method: 'post',
  283. redirect: {
  284. success: '/',
  285. failure: null
  286. },
  287. defaultErrors: ['未知错误!'],
  288. defaultMessages: ['You have been successfully logged in.']
  289. };
  290. _this.createUser = {
  291. endpoint: 'createUser',
  292. method: 'post',
  293. defaultErrors: ['未知错误!']
  294. };
  295. _this.updatePasswordForAdmin = {
  296. endpoint: 'updatePasswordForAdmin',
  297. method: 'patch',
  298. defaultErrors: ['未知错误!']
  299. };
  300. _this.register = {
  301. alwaysFail: false,
  302. endpoint: 'register',
  303. method: 'post',
  304. redirect: {
  305. success: '/',
  306. failure: null
  307. },
  308. defaultErrors: ['Something went wrong, please try again.'],
  309. defaultMessages: ['You have been successfully registered.']
  310. };
  311. _this.requestPass = {
  312. endpoint: 'request-pass',
  313. method: 'post',
  314. redirect: {
  315. success: '/',
  316. failure: null
  317. },
  318. defaultErrors: ['Something went wrong, please try again.'],
  319. defaultMessages: ['Reset password instructions have been sent to your email.']
  320. };
  321. _this.resetPass = {
  322. endpoint: 'updateUserPassword',
  323. method: 'patch',
  324. redirect: {
  325. success: '/',
  326. failure: null
  327. },
  328. defaultErrors: ['未知错误.'],
  329. defaultMessages: ['Your password has been successfully changed.']
  330. };
  331. _this.logout = {
  332. alwaysFail: false,
  333. endpoint: 'logout',
  334. method: 'delete',
  335. redirect: {
  336. success: '/',
  337. failure: null
  338. },
  339. defaultErrors: ['Something went wrong, please try again.'],
  340. defaultMessages: ['You have been successfully logged out.']
  341. };
  342. _this.errors = {
  343. key: 'messager',
  344. getter: (/**
  345. * @param {?} module
  346. * @param {?} res
  347. * @param {?} options
  348. * @return {?}
  349. */
  350. function (module, res, options) { return [
  351. getDeepFromObject(res.error, options.errors.key, options[module].defaultErrors)
  352. ]; })
  353. };
  354. _this.messages = {
  355. key: 'messager',
  356. getter: (/**
  357. * @param {?} module
  358. * @param {?} res
  359. * @param {?} options
  360. * @return {?}
  361. */
  362. function (module, res, options) { return [getDeepFromObject(res.body, options.messages.key, false)]; })
  363. };
  364. _this.success = {
  365. key: 'success',
  366. getter: (/**
  367. * @param {?} module
  368. * @param {?} res
  369. * @param {?} options
  370. * @return {?}
  371. */
  372. function (module, res, options) {
  373. return getDeepFromObject(res.body, options.success.key, options[module].defaultMessages);
  374. })
  375. };
  376. return _this;
  377. }
  378. return NamePasswordAuthStrategyOptions;
  379. }(auth.NbAuthStrategyOptions));
  380. /** @type {?} */
  381. var namePasswordStrategyOptions = new NamePasswordAuthStrategyOptions();
  382. /**
  383. * @fileoverview added by tsickle
  384. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  385. */
  386. var ResultError = /** @class */ (function () {
  387. function ResultError(message) {
  388. this.message = message;
  389. }
  390. return ResultError;
  391. }());
  392. var NamePasswordStrategyService = /** @class */ (function (_super) {
  393. __extends(NamePasswordStrategyService, _super);
  394. function NamePasswordStrategyService(http, route) {
  395. var _this = _super.call(this) || this;
  396. _this.http = http;
  397. _this.route = route;
  398. _this.defaultOptions = namePasswordStrategyOptions;
  399. return _this;
  400. }
  401. /**
  402. * @param {?} options
  403. * @return {?}
  404. */
  405. NamePasswordStrategyService.setup = /**
  406. * @param {?} options
  407. * @return {?}
  408. */
  409. function (options) {
  410. return [NamePasswordStrategyService, options];
  411. };
  412. /**
  413. * @param {?=} data
  414. * @return {?}
  415. */
  416. NamePasswordStrategyService.prototype.authenticate = /**
  417. * @param {?=} data
  418. * @return {?}
  419. */
  420. function (data) {
  421. var _this = this;
  422. /** @type {?} */
  423. var module = 'login';
  424. /** @type {?} */
  425. var method = this.getOption(module + ".method");
  426. /** @type {?} */
  427. var url = this.getActionEndpoint(module);
  428. /** @type {?} */
  429. var requireValidToken = this.getOption(module + ".requireValidToken");
  430. return this.getEncryptPassword(data.loginPassword).pipe(operators.map((/**
  431. * @param {?} body
  432. * @return {?}
  433. */
  434. function (body) {
  435. body.loginID = data.loginId;
  436. return _this.http.request(method, url, { body: body, observe: 'response' })
  437. .pipe(operators.map((/**
  438. * @param {?} res
  439. * @return {?}
  440. */
  441. function (res) {
  442. if (_this.getOption(module + ".alwaysFail")) {
  443. throw _this.createFailResponse(data);
  444. }
  445. else if (!_this.getOption('success.getter')(module, res, _this.options)) {
  446. throw new ResultError(_this.getOption('messages.getter')(module, res, _this.options));
  447. }
  448. return res;
  449. })), operators.map((/**
  450. * @param {?} res
  451. * @return {?}
  452. */
  453. function (res) {
  454. return new auth.NbAuthResult(true, res, _this.getOption(module + ".redirect.success"), [], _this.getOption('messages.getter')(module, res, _this.options));
  455. })), operators.catchError((/**
  456. * @param {?} res
  457. * @return {?}
  458. */
  459. function (res) {
  460. return _this.handleResponseError(res, module);
  461. })));
  462. })), operators.concatAll());
  463. };
  464. /**
  465. * @return {?}
  466. */
  467. NamePasswordStrategyService.prototype.logout = /**
  468. * @return {?}
  469. */
  470. function () {
  471. var _this = this;
  472. /** @type {?} */
  473. var module = 'logout';
  474. /** @type {?} */
  475. var method = this.getOption(module + ".method");
  476. /** @type {?} */
  477. var url = this.getActionEndpoint(module);
  478. return rxjs.of({})
  479. .pipe(operators.switchMap((/**
  480. * @param {?} res
  481. * @return {?}
  482. */
  483. function (res) {
  484. if (!url) {
  485. return rxjs.of(res);
  486. }
  487. return _this.http.request(method, url, { observe: 'response' });
  488. })), operators.map((/**
  489. * @param {?} res
  490. * @return {?}
  491. */
  492. function (res) {
  493. if (_this.getOption(module + ".alwaysFail")) {
  494. throw _this.createFailResponse();
  495. }
  496. return res;
  497. })), operators.map((/**
  498. * @param {?} res
  499. * @return {?}
  500. */
  501. function (res) {
  502. return new auth.NbAuthResult(true, res, _this.getOption(module + ".redirect.success"), [], _this.getOption('messages.getter')(module, res, _this.options));
  503. })), operators.catchError((/**
  504. * @param {?} res
  505. * @return {?}
  506. */
  507. function (res) {
  508. return _this.handleResponseError(res, module);
  509. })));
  510. };
  511. /**
  512. * @param {?=} data
  513. * @return {?}
  514. */
  515. NamePasswordStrategyService.prototype.refreshToken = /**
  516. * @param {?=} data
  517. * @return {?}
  518. */
  519. function (data) {
  520. return undefined;
  521. };
  522. /**
  523. * @param {?=} data
  524. * @return {?}
  525. */
  526. NamePasswordStrategyService.prototype.register = /**
  527. * @param {?=} data
  528. * @return {?}
  529. */
  530. function (data) {
  531. return undefined;
  532. };
  533. /**
  534. * @param {?=} data
  535. * @return {?}
  536. */
  537. NamePasswordStrategyService.prototype.requestPassword = /**
  538. * @param {?=} data
  539. * @return {?}
  540. */
  541. function (data) {
  542. return undefined;
  543. };
  544. /**
  545. * @param {?=} data
  546. * @return {?}
  547. */
  548. NamePasswordStrategyService.prototype.resetPassword = /**
  549. * @param {?=} data
  550. * @return {?}
  551. */
  552. function (data) {
  553. var _this = this;
  554. /** @type {?} */
  555. var module = 'resetPass';
  556. /** @type {?} */
  557. var method = this.getOption(module + ".method");
  558. /** @type {?} */
  559. var url = this.getActionEndpoint(module);
  560. return this.getEncryptPassword(data.loginPasswordNew + '-' + data.loginPasswordOld).pipe(operators.map((/**
  561. * @param {?} body
  562. * @return {?}
  563. */
  564. function (body) {
  565. body.passwordData = body.loginPassword;
  566. return _this.http.request(method, url, { body: body, observe: 'response' })
  567. .pipe(operators.map((/**
  568. * @param {?} res
  569. * @return {?}
  570. */
  571. function (res) {
  572. if (_this.getOption(module + ".alwaysFail")) {
  573. throw _this.createFailResponse(data);
  574. }
  575. else if (!_this.getOption('success.getter')(module, res, _this.options)) {
  576. throw new ResultError(_this.getOption('messages.getter')(module, res, _this.options));
  577. }
  578. return res;
  579. })), operators.map((/**
  580. * @param {?} res
  581. * @return {?}
  582. */
  583. function (res) {
  584. return new auth.NbAuthResult(true, res, _this.getOption(module + ".redirect.success"), [], _this.getOption('messages.getter')(module, res, _this.options));
  585. })), operators.catchError((/**
  586. * @param {?} res
  587. * @return {?}
  588. */
  589. function (res) {
  590. return _this.handleResponseError(res, module);
  591. })));
  592. })), operators.concatAll());
  593. };
  594. /**
  595. * @param {?=} data
  596. * @return {?}
  597. */
  598. NamePasswordStrategyService.prototype.createUser = /**
  599. * @param {?=} data
  600. * @return {?}
  601. */
  602. function (data) {
  603. var _this = this;
  604. /** @type {?} */
  605. var module = 'createUser';
  606. /** @type {?} */
  607. var method = this.getOption(module + ".method");
  608. /** @type {?} */
  609. var url = this.getActionEndpoint(module);
  610. return this.getEncryptPassword(data.loginPassword).pipe(operators.map((/**
  611. * @param {?} body
  612. * @return {?}
  613. */
  614. function (body) {
  615. body.userName = data.userName;
  616. body.loginID = data.loginID;
  617. return _this.http.request(method, url, { body: body, observe: 'response' })
  618. .pipe(operators.map((/**
  619. * @param {?} res
  620. * @return {?}
  621. */
  622. function (res) {
  623. if (_this.getOption(module + ".alwaysFail")) {
  624. throw _this.createFailResponse(data);
  625. }
  626. else if (!_this.getOption('success.getter')(module, res, _this.options)) {
  627. throw new ResultError(_this.getOption('messages.getter')(module, res, _this.options));
  628. }
  629. return res;
  630. })), operators.map((/**
  631. * @param {?} res
  632. * @return {?}
  633. */
  634. function (res) {
  635. return new auth.NbAuthResult(true, res, _this.getOption(module + ".redirect.success"), [], _this.getOption('messages.getter')(module, res, _this.options));
  636. })), operators.catchError((/**
  637. * @param {?} res
  638. * @return {?}
  639. */
  640. function (res) {
  641. return _this.handleResponseError(res, module);
  642. })));
  643. })), operators.concatAll());
  644. };
  645. /**
  646. * @param {?=} data
  647. * @return {?}
  648. */
  649. NamePasswordStrategyService.prototype.updatePasswordForAdmin = /**
  650. * @param {?=} data
  651. * @return {?}
  652. */
  653. function (data) {
  654. var _this = this;
  655. /** @type {?} */
  656. var module = 'updatePasswordForAdmin';
  657. /** @type {?} */
  658. var method = this.getOption(module + ".method");
  659. /** @type {?} */
  660. var url = this.getActionEndpoint(module);
  661. return this.getEncryptPassword(data.loginPassword).pipe(operators.map((/**
  662. * @param {?} body
  663. * @return {?}
  664. */
  665. function (body) {
  666. body.userID = data.userID;
  667. return _this.http.request(method, url, { body: body, observe: 'response' })
  668. .pipe(operators.map((/**
  669. * @param {?} res
  670. * @return {?}
  671. */
  672. function (res) {
  673. if (_this.getOption(module + ".alwaysFail")) {
  674. throw _this.createFailResponse(data);
  675. }
  676. else if (!_this.getOption('success.getter')(module, res, _this.options)) {
  677. throw new ResultError(_this.getOption('messages.getter')(module, res, _this.options));
  678. }
  679. return res;
  680. })), operators.map((/**
  681. * @param {?} res
  682. * @return {?}
  683. */
  684. function (res) {
  685. return new auth.NbAuthResult(true, res, _this.getOption(module + ".redirect.success"), [], _this.getOption('messages.getter')(module, res, _this.options));
  686. })), operators.catchError((/**
  687. * @param {?} res
  688. * @return {?}
  689. */
  690. function (res) {
  691. return _this.handleResponseError(res, module);
  692. })));
  693. })), operators.concatAll());
  694. };
  695. /**
  696. * @param {?} password
  697. * @return {?}
  698. */
  699. NamePasswordStrategyService.prototype.getEncryptPassword = /**
  700. * @param {?} password
  701. * @return {?}
  702. */
  703. function (password) {
  704. var _this = this;
  705. /** @type {?} */
  706. var module = 'getPublicKey';
  707. /** @type {?} */
  708. var method = this.getOption(module + ".method");
  709. /** @type {?} */
  710. var url = this.getActionEndpoint(module);
  711. return this.http.request(method, url, { observe: 'response' })
  712. .pipe(operators.map((/**
  713. * @param {?} res
  714. * @return {?}
  715. */
  716. function (res) {
  717. return encryptPassword(res.body, password);
  718. })), operators.catchError((/**
  719. * @param {?} res
  720. * @return {?}
  721. */
  722. function (res) {
  723. return _this.handleResponseError(res, module);
  724. })));
  725. /**
  726. * @param {?} result
  727. * @param {?} data
  728. * @return {?}
  729. */
  730. function encryptPassword(result, data) {
  731. /** @type {?} */
  732. var now = Date.now();
  733. /** @type {?} */
  734. var encrypt = new jsencrypt.JSEncrypt();
  735. encrypt.setPublicKey(result.data.publicPEMKey);
  736. /** @type {?} */
  737. var encryptPass = encrypt.encrypt(data + now);
  738. return {
  739. cryptoKeyID: result.data.cryptoKeyID,
  740. utcTimestamp: now,
  741. loginPassword: encryptPass
  742. };
  743. }
  744. };
  745. /**
  746. * @protected
  747. * @param {?} res
  748. * @param {?} module
  749. * @return {?}
  750. */
  751. NamePasswordStrategyService.prototype.handleResponseError = /**
  752. * @protected
  753. * @param {?} res
  754. * @param {?} module
  755. * @return {?}
  756. */
  757. function (res, module) {
  758. /** @type {?} */
  759. var errors = [];
  760. if (res instanceof http.HttpErrorResponse) {
  761. errors = this.getOption('errors.getter')(module, res, this.options);
  762. }
  763. else if (res instanceof auth.NbAuthIllegalTokenError) {
  764. errors.push(res.message);
  765. }
  766. else if (res instanceof ResultError) {
  767. errors = res.message;
  768. }
  769. else {
  770. errors.push('Something went wrong.');
  771. }
  772. return rxjs.of(new auth.NbAuthResult(false, res, this.getOption(module + ".redirect.failure"), errors));
  773. };
  774. NamePasswordStrategyService.decorators = [
  775. { type: core.Injectable }
  776. ];
  777. /** @nocollapse */
  778. NamePasswordStrategyService.ctorParameters = function () { return [
  779. { type: http.HttpClient },
  780. { type: router.ActivatedRoute }
  781. ]; };
  782. return NamePasswordStrategyService;
  783. }(auth.NbAuthStrategy));
  784. /**
  785. * @fileoverview added by tsickle
  786. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  787. */
  788. var ResetPasswordComponent = /** @class */ (function () {
  789. function ResetPasswordComponent(service, langService, options, cd, router) {
  790. if (options === void 0) { options = {}; }
  791. this.service = service;
  792. this.langService = langService;
  793. this.options = options;
  794. this.cd = cd;
  795. this.router = router;
  796. this.redirectDelay = 0;
  797. this.showMessages = {};
  798. this.strategy = '';
  799. this.submitted = false;
  800. this.errors = [];
  801. this.messages = [];
  802. this.user = {};
  803. this.redirectDelay = this.getConfigValue('forms.resetPassword.redirectDelay');
  804. this.showMessages = this.getConfigValue('forms.resetPassword.showMessages');
  805. this.strategy = this.getConfigValue('forms.resetPassword.strategy');
  806. }
  807. /**
  808. * @return {?}
  809. */
  810. ResetPasswordComponent.prototype.resetPass = /**
  811. * @return {?}
  812. */
  813. function () {
  814. var _this = this;
  815. this.errors = this.messages = [];
  816. this.submitted = true;
  817. this.service.resetPassword(this.strategy, this.user).subscribe((/**
  818. * @param {?} result
  819. * @return {?}
  820. */
  821. function (result) {
  822. _this.submitted = false;
  823. if (result.isSuccess()) {
  824. _this.messages = result.getMessages();
  825. }
  826. else {
  827. _this.errors = result.getErrors();
  828. }
  829. /** @type {?} */
  830. var redirect = result.getRedirect();
  831. if (redirect) {
  832. setTimeout((/**
  833. * @return {?}
  834. */
  835. function () {
  836. return _this.router.navigateByUrl(redirect);
  837. }), _this.redirectDelay);
  838. }
  839. _this.cd.detectChanges();
  840. }));
  841. };
  842. /**
  843. * @param {?} key
  844. * @return {?}
  845. */
  846. ResetPasswordComponent.prototype.getConfigValue = /**
  847. * @param {?} key
  848. * @return {?}
  849. */
  850. function (key) {
  851. return getDeepFromObject(this.options, key, null);
  852. };
  853. ResetPasswordComponent.decorators = [
  854. { type: core.Component, args: [{
  855. selector: 'auth-reset-password-page',
  856. template: "<h1 id=\"title\" class=\"title\" translate>\u4FEE\u6539\u5BC6\u7801</h1>\r\n<p class=\"sub-title\" translate>\u8BF7\u8BBE\u7F6E\u60A8\u7684\u65B0\u5BC6\u7801</p>\r\n\r\n<nb-alert *ngIf=\"showMessages.error && errors?.length && !submitted\" outline=\"danger\" role=\"alert\">\r\n <p class=\"alert-title\"><b translate>\u9519\u8BEF!</b></p>\r\n <ul class=\"alert-message-list\">\r\n <li *ngFor=\"let error of errors\" class=\"alert-message\">{{ error }}</li>\r\n </ul>\r\n</nb-alert>\r\n\r\n<nb-alert *ngIf=\"showMessages.success && messages?.length && !submitted\" outline=\"success\" role=\"alert\">\r\n <p class=\"alert-title\"><b translate>\u6210\u529F!</b></p>\r\n <ul class=\"alert-message-list\">\r\n <li *ngFor=\"let message of messages\" class=\"alert-message\">{{ message }}</li>\r\n </ul>\r\n</nb-alert>\r\n\r\n<form (ngSubmit)=\"resetPass()\" #resetPassForm=\"ngForm\" aria-labelledby=\"title\">\r\n\r\n <div class=\"form-control-group\">\r\n <label class=\"label\" for=\"input-old-password\" translate>\u65E7\u5BC6\u7801:</label>\r\n <input nbInput\r\n [(ngModel)]=\"user.loginPasswordOld\"\r\n #oldPassword=\"ngModel\"\r\n type=\"password\"\r\n id=\"input-old-password\"\r\n name=\"oldPassword\"\r\n class=\"first\"\r\n placeholder=\"{{'\u65B0\u5BC6\u7801'| translate}}\"\r\n autofocus\r\n fullWidth\r\n [status]=\"oldPassword.dirty ? (oldPassword.invalid ? 'danger' : 'success') : ''\"\r\n [required]=\"getConfigValue('forms.validation.password.required')\"\r\n [minlength]=\"getConfigValue('forms.validation.password.minLength')\"\r\n [maxlength]=\"getConfigValue('forms.validation.password.maxLength')\"\r\n [attr.aria-invalid]=\"oldPassword.invalid && oldPassword.touched ? true : null\">\r\n <ng-container *ngIf=\"oldPassword.invalid && oldPassword.touched\">\r\n <p class=\"error-message\" *ngIf=\"oldPassword.errors?.required\" translate=\"\u65E7\u5BC6\u7801\u662F\u5FC5\u586B\u7684!\">\r\n\r\n </p>\r\n <p class=\"error-message\" *ngIf=\"oldPassword.errors?.minlength || oldPassword.errors?.maxlength\"\r\n translate=\"\u5BC6\u7801\u89C4\u5219\u63D0\u793A\" [translateParams]=\"{minLength: getConfigValue('forms.validation.password.minLength'), maxLength:getConfigValue('forms.validation.password.maxLength')}\">\r\n \u5BC6\u7801\u5E94\u8BE5\u5305\u542B\r\n \u6700\u5C0F\u957F\u5EA6 {{ getConfigValue('forms.validation.password.minLength') }}\r\n \u6700\u5927\u957F\u5EA6 {{ getConfigValue('forms.validation.password.maxLength') }}\r\n \u4E2A\u5B57\u7B26\r\n </p>\r\n </ng-container>\r\n </div>\r\n\r\n <div class=\"form-control-group\">\r\n <label class=\"label\" for=\"input-new-password\" translate>\u65B0\u5BC6\u7801:</label>\r\n <input nbInput\r\n [(ngModel)]=\"user.loginPasswordNew\"\r\n #newPassword=\"ngModel\"\r\n type=\"password\"\r\n id=\"input-new-password\"\r\n name=\"newPassword\"\r\n class=\"first\"\r\n placeholder=\"{{'\u65B0\u5BC6\u7801'| translate}}\"\r\n autofocus\r\n fullWidth\r\n [status]=\"newPassword.dirty ? (newPassword.invalid ? 'danger' : 'success') : ''\"\r\n [required]=\"getConfigValue('forms.validation.password.required')\"\r\n [minlength]=\"getConfigValue('forms.validation.password.minLength')\"\r\n [maxlength]=\"getConfigValue('forms.validation.password.maxLength')\"\r\n [attr.aria-invalid]=\"newPassword.invalid && newPassword.touched ? true : null\">\r\n <ng-container *ngIf=\"newPassword.invalid && newPassword.touched\">\r\n <p class=\"error-message\" *ngIf=\"newPassword.errors?.required\" translate=\"\u65B0\u5BC6\u7801\u662F\u5FC5\u586B\u7684!\">\r\n\r\n </p>\r\n <p class=\"error-message\" *ngIf=\"newPassword.errors?.minlength || newPassword.errors?.maxlength\"\r\n translate=\"\u5BC6\u7801\u89C4\u5219\u63D0\u793A\"\r\n [translateParams]=\"{minLength: getConfigValue('forms.validation.password.minLength'), maxLength:getConfigValue('forms.validation.password.maxLength')}\">\r\n\r\n \u5BC6\u7801\u5E94\u8BE5\u5305\u542B\r\n \u6700\u5C0F\u957F\u5EA6 {{ getConfigValue('forms.validation.password.minLength') }}\r\n \u6700\u5927\u957F\u5EA6 {{ getConfigValue('forms.validation.password.maxLength') }}\r\n \u4E2A\u5B57\u7B26\r\n </p>\r\n </ng-container>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label class=\"label\" for=\"input-re-password\" translate>\u786E\u8BA4\u5BC6\u7801:</label>\r\n <input nbInput\r\n [(ngModel)]=\"user.confirmPassword\"\r\n #rePass=\"ngModel\"\r\n id=\"input-re-password\"\r\n name=\"rePass\"\r\n type=\"password\"\r\n class=\"last\"\r\n placeholder=\"{{'\u786E\u8BA4\u5BC6\u7801'| translate}}\"\r\n fullWidth\r\n [status]=\"rePass.touched\r\n ? (rePass.invalid || newPassword.value != rePass.value ? 'danger' : 'success')\r\n : ''\"\r\n [required]=\"getConfigValue('forms.validation.password.required')\"\r\n [attr.aria-invalid]=\"rePass.invalid && rePass.touched ? true : null\">\r\n <ng-container *ngIf=\"rePass.touched\">\r\n <p class=\"error-message\" *ngIf=\"rePass.invalid && rePass.errors?.required\" translate=\"\u786E\u8BA4\u5BC6\u7801\u662F\u5FC5\u586B\u7684!\">\r\n\r\n </p>\r\n <p class=\"error-message\" *ngIf=\"newPassword.value != rePass.value && !rePass.errors?.required\" translate=\"\u4E0E\u7B2C\u4E00\u6B21\u8F93\u5165\u4E0D\u7B26\u5408\"></p>\r\n </ng-container>\r\n </div>\r\n\r\n <button nbButton\r\n status=\"success\"\r\n fullWidth\r\n [disabled]=\"submitted || !resetPassForm.valid\"\r\n [class.btn-pulse]=\"submitted\" translate=\"\u4FEE\u6539\u5BC6\u7801\">\r\n </button>\r\n</form>\r\n\r\n<!--<section class=\"sign-in-or-up\" aria-label=\"Sign in or sign up\">-->\r\n <!--<p><a class=\"text-link\" routerLink=\"../login\">Back to Log In</a></p>-->\r\n <!--<p><a class=\"text-link\" routerLink=\"../register\">Register</a></p>-->\r\n<!--</section>-->\r\n",
  857. changeDetection: core.ChangeDetectionStrategy.OnPush,
  858. styles: [":host .form-group:last-of-type{margin-bottom:3rem}"]
  859. }] }
  860. ];
  861. /** @nocollapse */
  862. ResetPasswordComponent.ctorParameters = function () { return [
  863. { type: auth.NbAuthService },
  864. { type: LoginLangService },
  865. { type: undefined, decorators: [{ type: core.Inject, args: [auth.NB_AUTH_OPTIONS,] }] },
  866. { type: core.ChangeDetectorRef },
  867. { type: router.Router }
  868. ]; };
  869. return ResetPasswordComponent;
  870. }());
  871. /**
  872. * @fileoverview added by tsickle
  873. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  874. */
  875. var LogoutComponent = /** @class */ (function () {
  876. function LogoutComponent(service, langService, options, router) {
  877. if (options === void 0) { options = {}; }
  878. this.service = service;
  879. this.langService = langService;
  880. this.options = options;
  881. this.router = router;
  882. this.redirectDelay = 0;
  883. this.strategy = '';
  884. this.redirectDelay = this.getConfigValue('forms.logout.redirectDelay');
  885. this.strategy = this.getConfigValue('forms.logout.strategy');
  886. }
  887. /**
  888. * @return {?}
  889. */
  890. LogoutComponent.prototype.ngOnInit = /**
  891. * @return {?}
  892. */
  893. function () {
  894. this.logout(this.strategy);
  895. };
  896. /**
  897. * @param {?} strategy
  898. * @return {?}
  899. */
  900. LogoutComponent.prototype.logout = /**
  901. * @param {?} strategy
  902. * @return {?}
  903. */
  904. function (strategy) {
  905. var _this = this;
  906. this.service.logout(strategy).subscribe((/**
  907. * @param {?} result
  908. * @return {?}
  909. */
  910. function (result) {
  911. /** @type {?} */
  912. var redirect = result.getRedirect();
  913. if (redirect) {
  914. setTimeout((/**
  915. * @return {?}
  916. */
  917. function () {
  918. return _this.router.navigateByUrl(redirect);
  919. }), _this.redirectDelay);
  920. }
  921. }));
  922. };
  923. /**
  924. * @param {?} key
  925. * @return {?}
  926. */
  927. LogoutComponent.prototype.getConfigValue = /**
  928. * @param {?} key
  929. * @return {?}
  930. */
  931. function (key) {
  932. return auth.getDeepFromObject(this.options, key, null);
  933. };
  934. LogoutComponent.decorators = [
  935. { type: core.Component, args: [{
  936. selector: 'auth-logout',
  937. template: "<div translate=\"\u767B\u51FA\u63D0\u793A\"></div>\r\n",
  938. styles: ["div{text-align:center}"]
  939. }] }
  940. ];
  941. /** @nocollapse */
  942. LogoutComponent.ctorParameters = function () { return [
  943. { type: auth.NbAuthService },
  944. { type: LoginLangService },
  945. { type: undefined, decorators: [{ type: core.Inject, args: [auth.NB_AUTH_OPTIONS,] }] },
  946. { type: router.Router }
  947. ]; };
  948. return LogoutComponent;
  949. }());
  950. /**
  951. * @fileoverview added by tsickle
  952. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  953. */
  954. var LoginStatusService = /** @class */ (function () {
  955. function LoginStatusService() {
  956. this.subject = new rxjs.Subject();
  957. }
  958. /**
  959. * @param {?} status
  960. * @return {?}
  961. */
  962. LoginStatusService.prototype.changeStatus = /**
  963. * @param {?} status
  964. * @return {?}
  965. */
  966. function (status) {
  967. if (this.status !== status) {
  968. this.status = status;
  969. this.subject.next(status);
  970. }
  971. };
  972. LoginStatusService.decorators = [
  973. { type: core.Injectable }
  974. ];
  975. /** @nocollapse */
  976. LoginStatusService.ctorParameters = function () { return []; };
  977. return LoginStatusService;
  978. }());
  979. /** @enum {number} */
  980. var LoginStatus = {
  981. Login: 1,
  982. Logout: 2,
  983. };
  984. LoginStatus[LoginStatus.Login] = 'Login';
  985. LoginStatus[LoginStatus.Logout] = 'Logout';
  986. /**
  987. * @fileoverview added by tsickle
  988. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  989. */
  990. var GeAdminAuthModule = /** @class */ (function () {
  991. function GeAdminAuthModule() {
  992. }
  993. GeAdminAuthModule.decorators = [
  994. { type: core.NgModule, args: [{
  995. declarations: [
  996. LoginComponent,
  997. ResetPasswordComponent,
  998. LogoutComponent
  999. ],
  1000. imports: [
  1001. common.CommonModule,
  1002. theme.NbLayoutModule,
  1003. theme.NbCardModule,
  1004. theme.NbCheckboxModule,
  1005. theme.NbAlertModule,
  1006. theme.NbInputModule,
  1007. theme.NbButtonModule,
  1008. router.RouterModule,
  1009. forms.FormsModule,
  1010. core$1.TranslateModule.forRoot()
  1011. ],
  1012. providers: [
  1013. NamePasswordStrategyService,
  1014. LoginStatusService,
  1015. LoginLangService
  1016. ],
  1017. exports: [
  1018. LoginComponent,
  1019. ResetPasswordComponent,
  1020. LogoutComponent
  1021. ]
  1022. },] }
  1023. ];
  1024. return GeAdminAuthModule;
  1025. }());
  1026. exports.AUTH_DEFAULT_LANG = AUTH_DEFAULT_LANG;
  1027. exports.GeAdminAuthModule = GeAdminAuthModule;
  1028. exports.LoginComponent = LoginComponent;
  1029. exports.LoginLangService = LoginLangService;
  1030. exports.LoginStatus = LoginStatus;
  1031. exports.LoginStatusService = LoginStatusService;
  1032. exports.LogoutComponent = LogoutComponent;
  1033. exports.NamePasswordAuthStrategyOptions = NamePasswordAuthStrategyOptions;
  1034. exports.NamePasswordStrategyService = NamePasswordStrategyService;
  1035. exports.ResetPasswordComponent = ResetPasswordComponent;
  1036. exports.ResultError = ResultError;
  1037. exports.namePasswordStrategyOptions = namePasswordStrategyOptions;
  1038. Object.defineProperty(exports, '__esModule', { value: true });
  1039. })));
  1040. //# sourceMappingURL=ge-admin-auth.umd.js.map