UNPKG

ng-login-block

Version:

#### ng-login-block

68 lines (63 loc) 5.04 kB
import { Component, Input, NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { CommonModule } from '@angular/common'; import { NgLoginFormsModule } from 'ng-login-forms'; import { NgMixUiModule } from 'ng-mix-ui'; class NgLoginBlockComponent { constructor() { this.activeTab = 0; this.code = ''; this.email = ''; this.passAlong = {}; this.stage = {}; } ngOnInit() { if (sessionStorage.getItem('session')) { this.stage['logged-in'] = true; } } handleSuccess({ code, email }, tab) { this.code = code; this.email = email; this.activeTab = tab; this.stage = {}; } } NgLoginBlockComponent.decorators = [ { type: Component, args: [{ selector: 'ng-login-block', template: "<grid>\r\n <cell>\r\n <tile\r\n margin=\"20\"\r\n [style]=\"{ background: 'rgba(255,255,255,0.1)' }\"\r\n [style-main]=\"{ background: 'rgba(255,255,255,0.1)' }\"\r\n [style-tab-active]=\"{ background: 'rgba(255,255,255,0.1)', color: 'white' }\"\r\n [style-tab-idle]=\"{ background: 'rgba(0,0,0,0.1)', color: 'rgba(255,255,255,0.5)' }\"\r\n [tab]=\"activeTab\"\r\n [tab-save]=\"true\"\r\n title=\"Access Manager\"\r\n >\r\n <tab title=\"Register\">\r\n <register-form\r\n *ngIf=\"!stage['register-verify']\"\r\n [domain]=\"domain\"\r\n [url]=\"registerUrl\"\r\n (onSuccess)=\"passAlong = $event; stage = { 'register-verify': true }\"\r\n ></register-form>\r\n <verify-form\r\n *ngIf=\"stage['register-verify']\"\r\n [domain]=\"domain\"\r\n [email]=\"passAlong.email\"\r\n [url]=\"registerVerifyUrl\"\r\n (onSuccess)=\"handleSuccess($event, 1)\"\r\n ></verify-form>\r\n </tab>\r\n <tab title=\"Login\">\r\n <login-form\r\n *ngIf=\"!stage['logged-in']\"\r\n [domain]=\"domain\"\r\n [email]=\"passAlong.email\"\r\n [url]=\"loginUrl\"\r\n (onSuccess)=\"stage = { 'logged-in': true }\"\r\n ></login-form>\r\n <logout-form\r\n *ngIf=\"stage['logged-in']\"\r\n [domain]=\"domain\"\r\n [url]=\"logoutUrl\"\r\n (onSuccess)=\"stage = {}\"\r\n ></logout-form>\r\n </tab>\r\n <tab title=\"Forgot\">\r\n <forgot-form\r\n *ngIf=\"!stage['forgot-verify'] && !stage['forgot-password']\"\r\n [domain]=\"domain\"\r\n [url]=\"forgotUrl\"\r\n (onSuccess)=\"passAlong = $event; stage = { 'forgot-verify': true }\"\r\n ></forgot-form>\r\n <verify-form\r\n *ngIf=\"stage['forgot-verify']\"\r\n [domain]=\"domain\"\r\n [email]=\"passAlong.email\"\r\n [url]=\"forgotVerifyUrl\"\r\n (onSuccess)=\"passAlong = $event; stage = { 'forgot-password': true }\"\r\n ></verify-form>\r\n <password-form\r\n *ngIf=\"stage['forgot-password']\"\r\n [code]=\"passAlong.code\"\r\n [domain]=\"domain\"\r\n [email]=\"passAlong.email\"\r\n [url]=\"forgotPasswordUrl\"\r\n (onSuccess)=\"passAlong = $event; handleSuccess($event, 1)\"\r\n ></password-form>\r\n </tab>\r\n </tile>\r\n </cell>\r\n</grid>\r\n" },] } ]; NgLoginBlockComponent.ctorParameters = () => []; NgLoginBlockComponent.propDecorators = { domain: [{ type: Input }], forgotUrl: [{ type: Input }], forgotPasswordUrl: [{ type: Input }], forgotVerifyUrl: [{ type: Input }], loginUrl: [{ type: Input }], logoutUrl: [{ type: Input }], passwordUrl: [{ type: Input }], registerUrl: [{ type: Input }], registerVerifyUrl: [{ type: Input }], verifyUrl: [{ type: Input }] }; class NgLoginBlockModule { } NgLoginBlockModule.decorators = [ { type: NgModule, args: [{ declarations: [NgLoginBlockComponent], imports: [ BrowserModule, CommonModule, NgLoginFormsModule, NgMixUiModule ], exports: [NgLoginBlockComponent] },] } ]; /** * Generated bundle index. Do not edit. */ export { NgLoginBlockComponent, NgLoginBlockModule }; //# sourceMappingURL=ng-login-block.js.map