(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@nebular/theme'), require('@angular/forms'), require('rxjs/operators'), require('@angular/common/http'), require('jsencrypt'), require('@nebular/auth'), require('@angular/router'), require('@nebular/auth/helpers'), require('@angular/core'), require('rxjs'), require('@ngx-translate/core')) : typeof define === 'function' && define.amd ? define('ge-admin-auth', ['exports', '@angular/common', '@nebular/theme', '@angular/forms', 'rxjs/operators', '@angular/common/http', 'jsencrypt', '@nebular/auth', '@angular/router', '@nebular/auth/helpers', '@angular/core', 'rxjs', '@ngx-translate/core'], factory) : (factory((global['ge-admin-auth'] = {}),global.ng.common,global.theme,global.ng.forms,global.rxjs.operators,global.ng.common.http,global.JSEncrypt,global.auth,global.ng.router,global.helpers,global.ng.core,global.rxjs,global.core$1)); }(this, (function (exports,common,theme,forms,operators,http,JSEncrypt,auth,router,helpers,core,rxjs,core$1) { 'use strict'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var zhCn = { '与第一次输入不符合': '与第一次输入不符合.', '修改密码': '修改密码', '密码': '密码', '密码:': '密码:', '密码是必填的': '密码是必填的', '密码规则提示': '密码应该包含 最小长度 {{minLength}} 最大长度 {{maxLength}} 个字符', '您好,欢迎使用': '您好,欢迎使用', '成功!': '成功!', '新密码': '新密码', '新密码:': '新密码:', '新密码是必填的!': '新密码是必填的!', '旧密码:': '旧密码:', '旧密码是必填的!': '旧密码是必填的', '登出提示': '正在登出, 请等待...', '登录': '登录', '确认密码': '确认密码', '确认密码:': '确认密码:', '确认密码是必填的!': '确认密码是必填的!', '请设置您的新密码': '请设置您的新密码', '账户': '账户', '账户:': '账户:', '账户是必填的': '账户是必填的', '错误!': '错误!' }; var ZHCN = /*#__PURE__*/Object.freeze({ default: zhCn }); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var zhHk = { '与第一次输入不符合': '與第一次輸入不符合.', '修改密码': '更改密碼', '密码': '密碼', '密码:': '密碼:', '密码是必填的': '必須填寫密碼', '密码规则提示': '密碼應該包含 最小長度 {{minLength}} 最大長度 {{maxLength}} 個字符', '您好,欢迎使用': '您好,歡迎使用', '成功!': '成功!', '新密码': '新密碼', '新密码:': '新密碼:', '新密码是必填的!': '必須填寫新密碼', '旧密码:': '舊密碼:', '旧密码是必填的!': '必須填寫舊密碼', '登出提示': '正在登出, 請稍候⋯', '登录': '登入', '确认密码': '確認密碼', '确认密码:': '確認密碼:', '确认密码是必填的!': '必須填寫確認密碼', '请设置您的新密码': '請設置您的新密碼', '账户': '賬戶', '账户:': '賬戶:', '账户是必填的': '必須填寫賬戶', '错误!': '錯誤!' }; var ZHHK = /*#__PURE__*/Object.freeze({ default: zhHk }); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var AUTH_DEFAULT_LANG = new core.InjectionToken('AUTH_DEFAULT_LANG'); var LoginLangService = /** @class */ (function () { function LoginLangService(_translate, lang) { this._translate = _translate; this._translate.setTranslation('zh-cn', ZHCN); this._translate.setTranslation('zh-hk', ZHHK); this._translate.setDefaultLang(lang ? lang : 'zh-cn'); this._translate.use(lang ? lang : 'zh-cn'); } /** * @param {?=} lang * @return {?} */ LoginLangService.prototype.setTranslate = /** * @param {?=} lang * @return {?} */ function (lang) { this._translate.use(lang); }; LoginLangService.decorators = [ { type: core.Injectable } ]; /** @nocollapse */ LoginLangService.ctorParameters = function () { return [ { type: core$1.TranslateService }, { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [AUTH_DEFAULT_LANG,] }] } ]; }; return LoginLangService; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var LoginComponent = /** @class */ (function () { function LoginComponent(service, langService, options, cd, router$$1) { if (options === void 0) { options = {}; } this.service = service; this.langService = langService; this.options = options; this.cd = cd; this.router = router$$1; this.redirectDelay = 0; this.showMessages = {}; this.strategy = ''; this.errors = []; this.messages = []; this.user = {}; this.submitted = false; this.socialLinks = []; this.rememberMe = false; this.redirectDelay = this.getConfigValue('forms.login.redirectDelay'); this.showMessages = this.getConfigValue('forms.login.showMessages'); this.strategy = this.getConfigValue('forms.login.strategy'); this.socialLinks = this.getConfigValue('forms.login.socialLinks'); this.rememberMe = this.getConfigValue('forms.login.rememberMe'); } /** * @return {?} */ LoginComponent.prototype.login = /** * @return {?} */ function () { var _this = this; this.errors = []; this.messages = []; this.submitted = true; this.service.authenticate(this.strategy, this.user).subscribe(function (result) { _this.submitted = false; if (result.isSuccess()) { _this.messages = result.getMessages(); } else { _this.errors = result.getErrors(); } /** @type {?} */ var redirect = result.getRedirect(); if (redirect) { setTimeout(function () { return _this.router.navigateByUrl(redirect); }, _this.redirectDelay); } _this.cd.detectChanges(); }); }; /** * @param {?} key * @return {?} */ LoginComponent.prototype.getConfigValue = /** * @param {?} key * @return {?} */ function (key) { return helpers.getDeepFromObject(this.options, key, null); }; LoginComponent.decorators = [ { type: core.Component, args: [{ selector: 'auth-login', template: "

\u767B\u5F55

\r\n

\u60A8\u597D,\u6B22\u8FCE\u4F7F\u7528

\r\n\r\n\r\n

\u9519\u8BEF!

\r\n \r\n
\r\n\r\n\r\n

\u6210\u529F!

\r\n \r\n\r\n\r\n
\r\n
\r\n \r\n \r\n \r\n

\r\n\r\n

\r\n
\r\n
\r\n\r\n
\r\n \r\n \r\n \r\n

\r\n\r\n

\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

\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n", changeDetection: core.ChangeDetectionStrategy.OnPush }] } ]; /** @nocollapse */ LoginComponent.ctorParameters = function () { return [ { type: auth.NbAuthService }, { type: LoginLangService }, { type: undefined, decorators: [{ type: core.Inject, args: [auth.NB_AUTH_OPTIONS,] }] }, { type: core.ChangeDetectorRef }, { type: router.Router } ]; }; return LoginComponent; }()); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NamePasswordAuthStrategyOptions = /** @class */ (function (_super) { __extends(NamePasswordAuthStrategyOptions, _super); function NamePasswordAuthStrategyOptions() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.baseEndpoint = '/api/auth/'; _this.getPublicKey = { endpoint: 'getPublicKey', method: 'get' }; _this.login = { alwaysFail: false, endpoint: 'login', method: 'post', redirect: { success: '/', failure: null }, defaultErrors: ['未知错误!'], defaultMessages: ['You have been successfully logged in.'] }; _this.createUser = { endpoint: 'createUser', method: 'post', defaultErrors: ['未知错误!'] }; _this.updatePasswordForAdmin = { endpoint: 'updatePasswordForAdmin', method: 'patch', defaultErrors: ['未知错误!'] }; _this.register = { alwaysFail: false, endpoint: 'register', method: 'post', redirect: { success: '/', failure: null }, defaultErrors: ['Something went wrong, please try again.'], defaultMessages: ['You have been successfully registered.'] }; _this.requestPass = { endpoint: 'request-pass', method: 'post', redirect: { success: '/', failure: null }, defaultErrors: ['Something went wrong, please try again.'], defaultMessages: ['Reset password instructions have been sent to your email.'] }; _this.resetPass = { endpoint: 'updateUserPassword', method: 'patch', redirect: { success: '/', failure: null }, defaultErrors: ['未知错误.'], defaultMessages: ['Your password has been successfully changed.'] }; _this.logout = { alwaysFail: false, endpoint: 'logout', method: 'delete', redirect: { success: '/', failure: null }, defaultErrors: ['Something went wrong, please try again.'], defaultMessages: ['You have been successfully logged out.'] }; _this.errors = { key: 'messager', getter: function (module, res, options) { return [ helpers.getDeepFromObject(res.error, options.errors.key, options[module].defaultErrors) ]; } }; _this.messages = { key: 'messager', getter: function (module, res, options) { return [helpers.getDeepFromObject(res.body, options.messages.key, false)]; } }; _this.success = { key: 'success', getter: function (module, res, options) { return helpers.getDeepFromObject(res.body, options.success.key, options[module].defaultMessages); } }; return _this; } return NamePasswordAuthStrategyOptions; }(auth.NbAuthStrategyOptions)); /** @type {?} */ var namePasswordStrategyOptions = new NamePasswordAuthStrategyOptions(); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ResultError = /** @class */ (function () { function ResultError(message) { this.message = message; } return ResultError; }()); var NamePasswordStrategyService = /** @class */ (function (_super) { __extends(NamePasswordStrategyService, _super); function NamePasswordStrategyService(http$$1, route) { var _this = _super.call(this) || this; _this.http = http$$1; _this.route = route; _this.defaultOptions = namePasswordStrategyOptions; return _this; } /** * @param {?} options * @return {?} */ NamePasswordStrategyService.setup = /** * @param {?} options * @return {?} */ function (options) { return [NamePasswordStrategyService, options]; }; /** * @param {?=} data * @return {?} */ NamePasswordStrategyService.prototype.authenticate = /** * @param {?=} data * @return {?} */ function (data) { var _this = this; /** @type {?} */ var module = 'login'; /** @type {?} */ var method = this.getOption(module + ".method"); /** @type {?} */ var url = this.getActionEndpoint(module); /** @type {?} */ var requireValidToken = this.getOption(module + ".requireValidToken"); return this.getEncryptPassword(data.loginPassword).pipe(operators.map(function (body) { body.loginID = data.loginId; return _this.http.request(method, url, { body: body, observe: 'response' }) .pipe(operators.map(function (res) { if (_this.getOption(module + ".alwaysFail")) { throw _this.createFailResponse(data); } else if (!_this.getOption('success.getter')(module, res, _this.options)) { throw new ResultError(_this.getOption('messages.getter')(module, res, _this.options)); } return res; }), operators.map(function (res) { return new auth.NbAuthResult(true, res, _this.getOption(module + ".redirect.success"), [], _this.getOption('messages.getter')(module, res, _this.options)); }), operators.catchError(function (res) { return _this.handleResponseError(res, module); })); }), operators.concatAll()); }; /** * @return {?} */ NamePasswordStrategyService.prototype.logout = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var module = 'logout'; /** @type {?} */ var method = this.getOption(module + ".method"); /** @type {?} */ var url = this.getActionEndpoint(module); return rxjs.of({}) .pipe(operators.switchMap(function (res) { if (!url) { return rxjs.of(res); } return _this.http.request(method, url, { observe: 'response' }); }), operators.map(function (res) { if (_this.getOption(module + ".alwaysFail")) { throw _this.createFailResponse(); } return res; }), operators.map(function (res) { return new auth.NbAuthResult(true, res, _this.getOption(module + ".redirect.success"), [], _this.getOption('messages.getter')(module, res, _this.options)); }), operators.catchError(function (res) { return _this.handleResponseError(res, module); })); }; /** * @param {?=} data * @return {?} */ NamePasswordStrategyService.prototype.refreshToken = /** * @param {?=} data * @return {?} */ function (data) { return undefined; }; /** * @param {?=} data * @return {?} */ NamePasswordStrategyService.prototype.register = /** * @param {?=} data * @return {?} */ function (data) { return undefined; }; /** * @param {?=} data * @return {?} */ NamePasswordStrategyService.prototype.requestPassword = /** * @param {?=} data * @return {?} */ function (data) { return undefined; }; /** * @param {?=} data * @return {?} */ NamePasswordStrategyService.prototype.resetPassword = /** * @param {?=} data * @return {?} */ function (data) { var _this = this; /** @type {?} */ var module = 'resetPass'; /** @type {?} */ var method = this.getOption(module + ".method"); /** @type {?} */ var url = this.getActionEndpoint(module); return this.getEncryptPassword(data.loginPasswordNew + '-' + data.loginPasswordOld).pipe(operators.map(function (body) { body.passwordData = body.loginPassword; return _this.http.request(method, url, { body: body, observe: 'response' }) .pipe(operators.map(function (res) { if (_this.getOption(module + ".alwaysFail")) { throw _this.createFailResponse(data); } else if (!_this.getOption('success.getter')(module, res, _this.options)) { throw new ResultError(_this.getOption('messages.getter')(module, res, _this.options)); } return res; }), operators.map(function (res) { return new auth.NbAuthResult(true, res, _this.getOption(module + ".redirect.success"), [], _this.getOption('messages.getter')(module, res, _this.options)); }), operators.catchError(function (res) { return _this.handleResponseError(res, module); })); }), operators.concatAll()); }; /** * @param {?=} data * @return {?} */ NamePasswordStrategyService.prototype.createUser = /** * @param {?=} data * @return {?} */ function (data) { var _this = this; /** @type {?} */ var module = 'createUser'; /** @type {?} */ var method = this.getOption(module + ".method"); /** @type {?} */ var url = this.getActionEndpoint(module); return this.getEncryptPassword(data.loginPassword).pipe(operators.map(function (body) { body.userName = data.userName; body.loginID = data.loginID; return _this.http.request(method, url, { body: body, observe: 'response' }) .pipe(operators.map(function (res) { if (_this.getOption(module + ".alwaysFail")) { throw _this.createFailResponse(data); } else if (!_this.getOption('success.getter')(module, res, _this.options)) { throw new ResultError(_this.getOption('messages.getter')(module, res, _this.options)); } return res; }), operators.map(function (res) { return new auth.NbAuthResult(true, res, _this.getOption(module + ".redirect.success"), [], _this.getOption('messages.getter')(module, res, _this.options)); }), operators.catchError(function (res) { return _this.handleResponseError(res, module); })); }), operators.concatAll()); }; /** * @param {?=} data * @return {?} */ NamePasswordStrategyService.prototype.updatePasswordForAdmin = /** * @param {?=} data * @return {?} */ function (data) { var _this = this; /** @type {?} */ var module = 'updatePasswordForAdmin'; /** @type {?} */ var method = this.getOption(module + ".method"); /** @type {?} */ var url = this.getActionEndpoint(module); return this.getEncryptPassword(data.loginPassword).pipe(operators.map(function (body) { body.userID = data.userID; return _this.http.request(method, url, { body: body, observe: 'response' }) .pipe(operators.map(function (res) { if (_this.getOption(module + ".alwaysFail")) { throw _this.createFailResponse(data); } else if (!_this.getOption('success.getter')(module, res, _this.options)) { throw new ResultError(_this.getOption('messages.getter')(module, res, _this.options)); } return res; }), operators.map(function (res) { return new auth.NbAuthResult(true, res, _this.getOption(module + ".redirect.success"), [], _this.getOption('messages.getter')(module, res, _this.options)); }), operators.catchError(function (res) { return _this.handleResponseError(res, module); })); }), operators.concatAll()); }; /** * @param {?} password * @return {?} */ NamePasswordStrategyService.prototype.getEncryptPassword = /** * @param {?} password * @return {?} */ function (password) { var _this = this; /** @type {?} */ var module = 'getPublicKey'; /** @type {?} */ var method = this.getOption(module + ".method"); /** @type {?} */ var url = this.getActionEndpoint(module); return this.http.request(method, url, { observe: 'response' }) .pipe(operators.map(function (res) { return encryptPassword(res.body, password); }), operators.catchError(function (res) { return _this.handleResponseError(res, module); })); /** * @param {?} result * @param {?} data * @return {?} */ function encryptPassword(result, data) { /** @type {?} */ var now = Date.now(); /** @type {?} */ var encrypt = new JSEncrypt.JSEncrypt(); encrypt.setPublicKey(result.data.publicPEMKey); /** @type {?} */ var encryptPass = encrypt.encrypt(data + now); return { cryptoKeyID: result.data.cryptoKeyID, utcTimestamp: now, loginPassword: encryptPass }; } }; /** * @protected * @param {?} res * @param {?} module * @return {?} */ NamePasswordStrategyService.prototype.handleResponseError = /** * @protected * @param {?} res * @param {?} module * @return {?} */ function (res, module) { /** @type {?} */ var errors = []; if (res instanceof http.HttpErrorResponse) { errors = this.getOption('errors.getter')(module, res, this.options); } else if (res instanceof auth.NbAuthIllegalTokenError) { errors.push(res.message); } else if (res instanceof ResultError) { errors = res.message; } else { errors.push('Something went wrong.'); } return rxjs.of(new auth.NbAuthResult(false, res, this.getOption(module + ".redirect.failure"), errors)); }; NamePasswordStrategyService.decorators = [ { type: core.Injectable } ]; /** @nocollapse */ NamePasswordStrategyService.ctorParameters = function () { return [ { type: http.HttpClient }, { type: router.ActivatedRoute } ]; }; return NamePasswordStrategyService; }(auth.NbAuthStrategy)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ResetPasswordComponent = /** @class */ (function () { function ResetPasswordComponent(service, langService, options, cd, router$$1) { if (options === void 0) { options = {}; } this.service = service; this.langService = langService; this.options = options; this.cd = cd; this.router = router$$1; this.redirectDelay = 0; this.showMessages = {}; this.strategy = ''; this.submitted = false; this.errors = []; this.messages = []; this.user = {}; this.redirectDelay = this.getConfigValue('forms.resetPassword.redirectDelay'); this.showMessages = this.getConfigValue('forms.resetPassword.showMessages'); this.strategy = this.getConfigValue('forms.resetPassword.strategy'); } /** * @return {?} */ ResetPasswordComponent.prototype.resetPass = /** * @return {?} */ function () { var _this = this; this.errors = this.messages = []; this.submitted = true; this.service.resetPassword(this.strategy, this.user).subscribe(function (result) { _this.submitted = false; if (result.isSuccess()) { _this.messages = result.getMessages(); } else { _this.errors = result.getErrors(); } /** @type {?} */ var redirect = result.getRedirect(); if (redirect) { setTimeout(function () { return _this.router.navigateByUrl(redirect); }, _this.redirectDelay); } _this.cd.detectChanges(); }); }; /** * @param {?} key * @return {?} */ ResetPasswordComponent.prototype.getConfigValue = /** * @param {?} key * @return {?} */ function (key) { return helpers.getDeepFromObject(this.options, key, null); }; ResetPasswordComponent.decorators = [ { type: core.Component, args: [{ selector: 'auth-reset-password-page', template: "

\u4FEE\u6539\u5BC6\u7801

\r\n

\u8BF7\u8BBE\u7F6E\u60A8\u7684\u65B0\u5BC6\u7801

\r\n\r\n\r\n

\u9519\u8BEF!

\r\n
    \r\n
  • {{ error }}
  • \r\n
\r\n
\r\n\r\n\r\n

\u6210\u529F!

\r\n
    \r\n
  • {{ message }}
  • \r\n
\r\n
\r\n\r\n
\r\n\r\n
\r\n \r\n \r\n \r\n

\r\n\r\n

\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

\r\n
\r\n
\r\n\r\n
\r\n \r\n \r\n \r\n

\r\n\r\n

\r\n

\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

\r\n
\r\n
\r\n\r\n
\r\n \r\n \r\n \r\n

\r\n\r\n

\r\n

\r\n
\r\n
\r\n\r\n \r\n
\r\n\r\n\r\n \r\n \r\n\r\n", changeDetection: core.ChangeDetectionStrategy.OnPush, styles: [":host .form-group:last-of-type{margin-bottom:3rem}"] }] } ]; /** @nocollapse */ ResetPasswordComponent.ctorParameters = function () { return [ { type: auth.NbAuthService }, { type: LoginLangService }, { type: undefined, decorators: [{ type: core.Inject, args: [auth.NB_AUTH_OPTIONS,] }] }, { type: core.ChangeDetectorRef }, { type: router.Router } ]; }; return ResetPasswordComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var LogoutComponent = /** @class */ (function () { function LogoutComponent(service, langService, options, router$$1) { if (options === void 0) { options = {}; } this.service = service; this.langService = langService; this.options = options; this.router = router$$1; this.redirectDelay = 0; this.strategy = ''; this.redirectDelay = this.getConfigValue('forms.logout.redirectDelay'); this.strategy = this.getConfigValue('forms.logout.strategy'); } /** * @return {?} */ LogoutComponent.prototype.ngOnInit = /** * @return {?} */ function () { this.logout(this.strategy); }; /** * @param {?} strategy * @return {?} */ LogoutComponent.prototype.logout = /** * @param {?} strategy * @return {?} */ function (strategy) { var _this = this; this.service.logout(strategy).subscribe(function (result) { /** @type {?} */ var redirect = result.getRedirect(); if (redirect) { setTimeout(function () { return _this.router.navigateByUrl(redirect); }, _this.redirectDelay); } }); }; /** * @param {?} key * @return {?} */ LogoutComponent.prototype.getConfigValue = /** * @param {?} key * @return {?} */ function (key) { return helpers.getDeepFromObject(this.options, key, null); }; LogoutComponent.decorators = [ { type: core.Component, args: [{ selector: 'auth-logout', template: "
\r\n", styles: ["div{text-align:center}"] }] } ]; /** @nocollapse */ LogoutComponent.ctorParameters = function () { return [ { type: auth.NbAuthService }, { type: LoginLangService }, { type: undefined, decorators: [{ type: core.Inject, args: [auth.NB_AUTH_OPTIONS,] }] }, { type: router.Router } ]; }; return LogoutComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var LoginStatusService = /** @class */ (function () { function LoginStatusService() { this.subject = new rxjs.Subject(); } /** * @param {?} status * @return {?} */ LoginStatusService.prototype.changeStatus = /** * @param {?} status * @return {?} */ function (status) { if (this.status !== status) { this.status = status; this.subject.next(status); } }; LoginStatusService.decorators = [ { type: core.Injectable } ]; /** @nocollapse */ LoginStatusService.ctorParameters = function () { return []; }; return LoginStatusService; }()); /** @enum {number} */ var LoginStatus = { Login: 1, Logout: 2, }; LoginStatus[LoginStatus.Login] = 'Login'; LoginStatus[LoginStatus.Logout] = 'Logout'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var GeAdminAuthModule = /** @class */ (function () { function GeAdminAuthModule() { } GeAdminAuthModule.decorators = [ { type: core.NgModule, args: [{ declarations: [ LoginComponent, ResetPasswordComponent, LogoutComponent ], imports: [ common.CommonModule, theme.NbLayoutModule, theme.NbCardModule, theme.NbCheckboxModule, theme.NbAlertModule, theme.NbInputModule, theme.NbButtonModule, router.RouterModule, forms.FormsModule, core$1.TranslateModule.forRoot(), auth.NbAuthModule.forRoot() ], providers: [ NamePasswordStrategyService, LoginStatusService, LoginLangService ], exports: [ LoginComponent, ResetPasswordComponent, LogoutComponent ] },] } ]; return GeAdminAuthModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ exports.GeAdminAuthModule = GeAdminAuthModule; exports.LoginStatusService = LoginStatusService; exports.LoginStatus = LoginStatus; exports.LoginComponent = LoginComponent; exports.LogoutComponent = LogoutComponent; exports.ResetPasswordComponent = ResetPasswordComponent; exports.ResultError = ResultError; exports.NamePasswordStrategyService = NamePasswordStrategyService; exports.NamePasswordAuthStrategyOptions = NamePasswordAuthStrategyOptions; exports.namePasswordStrategyOptions = namePasswordStrategyOptions; exports.AUTH_DEFAULT_LANG = AUTH_DEFAULT_LANG; exports.LoginLangService = LoginLangService; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=ge-admin-auth.umd.js.map