UNPKG

@nowzoo/ngx-firebase-auth

Version:

Angular components for Firebase email-first sign in and out-of-band (oob) actions (reset password, etc).

2 lines 55.5 kB
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/animations"),require("@angular/core"),require("angularfire2/auth"),require("firebase/app"),require("@angular/router"),require("rxjs"),require("rxjs/operators"),require("@angular/forms"),require("@angular/common")):"function"==typeof define&&define.amd?define("@nowzoo/ngx-firebase-auth",["exports","@angular/animations","@angular/core","angularfire2/auth","firebase/app","@angular/router","rxjs","rxjs/operators","@angular/forms","@angular/common"],n):n((e.nowzoo=e.nowzoo||{},e.nowzoo["ngx-firebase-auth"]={}),e.ng.animations,e.ng.core,null,null,e.ng.router,e.rxjs,e.rxjs.operators,e.ng.forms,e.ng.common)}(this,function(e,n,a,t,i,r,s,o,u,c){"use strict";var d=n.trigger("fadeInOut",[n.state("in",n.style({opacity:1,display:"block"})),n.transition("void => *",[n.style({opacity:0}),n.animate(300)]),n.transition("* => void",[n.animate(300,n.style({opacity:0}))])]),l=n.trigger("screen",[n.state("in",n.style({opacity:1})),n.transition("void => *",[n.style({opacity:0}),n.animate(300)]),n.transition("* => void",[n.animate(0,n.style({opacity:0}))])]),m=function(e){switch(e){case"twitter.com":return"Twitter";case"facebook.com":return"Facebook";case"google.com":return"Google";case"github.com":return"GitHub";default:return e}},h=function(e){switch(e){case"twitter.com":case"facebook.com":case"google.com":case"github.com":return"fab fa-fw fa-"+e.replace(".com","");default:return"fas fa-fw fa-sign-in-alt"}},p=function(){function s(e){this._afAuth=e}return Object.defineProperty(s.prototype,"auth",{get:function(){return this._afAuth.auth},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"storage",{get:function(){return window.localStorage},enumerable:!0,configurable:!0}),s.prototype.getRemembered=function(){var e=this.storage.getItem(s.rememberKey);if(e)try{return JSON.parse(e)}catch(n){return{email:"",remember:!0}}return{email:"",remember:!0}},s.prototype.setRemembered=function(t,r){var a=this,e=t?i.auth.Auth.Persistence.LOCAL:i.auth.Auth.Persistence.SESSION;return this.auth.setPersistence(e).then(function(){var e={email:t?r:"",remember:t},n=JSON.stringify(e);return a.storage.setItem(s.rememberKey,n),e})},s.rememberKey="ngx-firebase-auth-remember",s.decorators=[{type:a.Injectable,args:[{providedIn:"root"}]}],s.ctorParameters=function(){return[{type:t.AngularFireAuth}]},s.ngInjectableDef=a.defineInjectable({factory:function e(){return new s(a.inject(t.AngularFireAuth))},token:s,providedIn:"root"}),s}(),f=function(){function e(e,n,t,r){this._afAuth=e,this._svc=n,this._route=t,this._router=r,this.ngUnsubscribe=new s.Subject,this.tosTemplate=null,this.success=new a.EventEmitter,this.mode=new a.EventEmitter,this.initialOAuthError=null,this.signedOut=!1,this.oAuthProviderId=null,this.cred=null,this.unhandledError=null,this.screen="wait"}return Object.defineProperty(e.prototype,"auth",{get:function(){return this._afAuth.auth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"authService",{get:function(){return this._svc},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"router",{get:function(){return this._router},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"route",{get:function(){return this._route},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"queryParams",{get:function(){return this.route.queryParams},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"snapshotQueryParams",{get:function(){return this.route.snapshot.queryParams},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.init()},e.prototype.ngOnDestroy=function(){this.ngUnsubscribe.next(),this.ngUnsubscribe.complete()},e.prototype.init=function(){var n=this,e=this.authService.getRemembered();return this.remember=e.remember,this.email=e.email,this.onInitHandleSignOut().then(function(e){return e||n.onInitHandleOAuthRedirect()}).then(function(e){e||n.showSignIn(),n.queryParams.pipe(o.takeUntil(n.ngUnsubscribe)).subscribe(function(e){switch(e.action||null){case"signOut":n.showSignOut();break;case"resetPassword":n.showResetPassword();break;case"signIn":n.showSignIn();break;case"signInPassword":n.showSignInPassword();break;case"signUpPassword":n.showSignUpPassword();break;case"signInOAuth":n.showSignInOAuth(e.providerId,null)}})})},e.prototype.onInitHandleSignOut=function(){return"signOut"!==this.snapshotQueryParams.action?Promise.resolve(!1):this.showSignOut().then(function(){return!0})},e.prototype.onInitHandleOAuthRedirect=function(){var r=this;return new Promise(function(n){var t="true"===r.route.snapshot.queryParams.remember;return r.auth.getRedirectResult().then(function(e){r.auth.currentUser&&e.user?r.authService.setRemembered(t,e.user.email).then(function(){r.showSignInSuccess(e),n(!0)}):n(!1)})["catch"](function(e){r.showSignInOAuth(null,e),n(!0)})})},e.prototype.showSignOut=function(){var e=this;return this.signedOut=!1,this.screen="wait",this.auth.signOut().then(function(){e.showSignIn(!0)})},e.prototype.showSignIn=function(e){this.mode.emit("signIn"),this.signedOut=!0===e,this.screen="signIn"},e.prototype.showSignInPassword=function(){this.mode.emit("signIn"),this.signedOut=!1,this.screen="signInPassword"},e.prototype.showSignUpPassword=function(){this.mode.emit("signIn"),this.signedOut=!1,this.screen="signUpPassword"},e.prototype.showSignInOAuth=function(e,n){this.mode.emit("signIn"),this.signedOut=!1,this.oAuthProviderId=e,this.initialOAuthError=n,this.screen="signInOAuth"},e.prototype.showSignInSuccess=function(e){this.mode.emit("signIn"),this.signedOut=!1,this.cred=e,this.screen="signInSuccess",this.success.emit(e)},e.prototype.showResetPassword=function(){this.mode.emit("resetPassword"),this.signedOut=!1,this.screen="resetPassword"},e.prototype.showUnhandledError=function(e){this.signedOut=!1,this.unhandledError=e,this.screen="unhandledError"},e.decorators=[{type:a.Component,args:[{selector:"ngx-firebase-auth-sign-in",template:'<div *ngIf="\'wait\' === screen" [@screen]="\'in\'">\n  <div class="alert alert-secondary">\n    <i class="fas fa-spin fa-spinner fa-fw" aria-hidden="true"></i>\n    Please wait...\n  </div>\n</div>\n\n<div *ngIf="\'unhandledError\' === screen" [@screen]="\'in\'">\n  <div class="alert alert-danger">\n    <i class="fas fa-exclamation-triangle fa-fw text-danger" aria-hidden="true"></i>\n    <strong>Woops!</strong> An unexpected error occurred.\n  </div>\n  <p class="text-muted">\n    Code: {{unhandledError.code}}. Message: {{unhandledError.message}}\n  </p>\n  <p>\n    <a routerLink="." [queryParams]="{action: \'signIn\'}">Start Over</a>\n  </p>\n</div>\n\n\n<div *ngIf="\'signInSuccess\' === screen" [@screen]="\'in\'">\n  <div class="alert alert-success">\n    <i class="fas fa-check fa-fw" aria-hidden="true"></i>\n    Welcome, {{cred.user.displayName}}!\n  </div>\n</div>\n\n\n\n\n<div *ngIf="\'signIn\' === screen" [@screen]="\'in\'">\n  <div class="alert alert-success" *ngIf="signedOut">\n    <i class="fas fa-check fa-fw" aria-hidden="true"></i>\n    You’re signed out.\n  </div>\n  <ngx-firebase-auth-sign-in-methods-form\n    [(email)]="email"\n    [(remember)]="remember"\n    [oAuthProviderIds]="oAuthProviderIds"\n    (error)="showUnhandledError($event)"\n    (success)="showSignInSuccess($event)"></ngx-firebase-auth-sign-in-methods-form>\n  <small class="text-center text-muted my-2 form-text">\n    <ng-container *ngTemplateOutlet="tosTemplate"></ng-container>\n  </small>\n</div>\n\n<div *ngIf="\'signInPassword\' === screen" [@screen]="\'in\'">\n  <ngx-firebase-auth-sign-in-form\n    [email]="email"\n    [(remember)]="remember"\n    (error)="showUnhandledError($event)"\n    (success)="showSignInSuccess($event)"></ngx-firebase-auth-sign-in-form>\n  <small class="text-center text-muted my-2 form-text">\n    <ng-container *ngTemplateOutlet="tosTemplate"></ng-container>\n  </small>\n</div>\n\n<div *ngIf="\'signUpPassword\' === screen" [@screen]="\'in\'">\n  <ngx-firebase-auth-sign-up-form\n    [email]="email"\n    [(remember)]="remember"\n    (error)="showUnhandledError($event)"\n    (success)="showSignInSuccess($event)"></ngx-firebase-auth-sign-up-form>\n  <small class="text-center text-muted my-2 form-text">\n    <ng-container *ngTemplateOutlet="tosTemplate"></ng-container>\n  </small>\n</div>\n\n<div *ngIf="\'signInOAuth\' === screen" [@screen]="\'in\'">\n  <ngx-firebase-auth-sign-in-oauth\n    [providerId]="oAuthProviderId"\n    [initialError]="initialOAuthError"\n    [useOAuthPopup]="useOAuthPopup"\n    [oAuthProviderFactory]="oAuthProviderFactory"\n    [(email)]="email"\n    [(remember)]="remember"\n    (error)="showUnhandledError($event)"\n    (success)="showSignInSuccess($event)"></ngx-firebase-auth-sign-in-oauth>\n  <small class="text-center text-muted my-2 form-text">\n    <ng-container *ngTemplateOutlet="tosTemplate"></ng-container>\n  </small>\n</div>\n\n\n\n<div *ngIf="\'resetPassword\' === screen" [@screen]="\'in\'">\n  <h6>Reset Password</h6>\n  <ngx-firebase-auth-reset-password-send-form\n    [(email)]="email"\n    (error)="showUnhandledError($event)"></ngx-firebase-auth-reset-password-send-form>\n</div>\n',styles:[""],animations:[l]}]}],e.ctorParameters=function(){return[{type:t.AngularFireAuth},{type:p},{type:r.ActivatedRoute},{type:r.Router}]},e.propDecorators={oAuthProviderIds:[{type:a.Input}],useOAuthPopup:[{type:a.Input}],oAuthProviderFactory:[{type:a.Input}],tosTemplate:[{type:a.Input}],success:[{type:a.Output}],mode:[{type:a.Output}]},e}(),g=function(){function e(e){this._route=e,this.screen=null,this.mode=new a.EventEmitter,this.navigationError=new a.EventEmitter,this.success=new a.EventEmitter}return Object.defineProperty(e.prototype,"queryParams",{get:function(){return this._route.snapshot.queryParams},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){if(this.oobCode=this.queryParams.oobCode||null,this.oobCode)switch(this.queryParams.mode){case"resetPassword":case"verifyEmail":case"recoverEmail":this.screen=this.queryParams.mode,this.mode.emit(this.queryParams.mode);break;default:this.navigationError.emit()}else this.navigationError.emit()},e.decorators=[{type:a.Component,args:[{selector:"ngx-firebase-auth-oob",template:'<div *ngIf="\'resetPassword\' === screen" [@screen]="\'in\'">\n  <ngx-firebase-auth-oob-reset-password\n    [oobCode]="oobCode"\n    (success)="success.emit($event)"></ngx-firebase-auth-oob-reset-password>\n</div>\n\n<div *ngIf="\'verifyEmail\' === screen" [@screen]="\'in\'">\n  <ngx-firebase-auth-oob-verify-email\n    [oobCode]="oobCode"\n    (success)="success.emit($event)"></ngx-firebase-auth-oob-verify-email>\n</div>\n\n<div *ngIf="\'recoverEmail\' === screen" [@screen]="\'in\'">\n  <ngx-firebase-auth-oob-recover-email\n    [oobCode]="oobCode"\n    (success)="success.emit($event)"></ngx-firebase-auth-oob-recover-email>\n</div>\n',styles:[""],animations:[l]}]}],e.ctorParameters=function(){return[{type:r.ActivatedRoute}]},e.propDecorators={mode:[{type:a.Output}],navigationError:[{type:a.Output}],success:[{type:a.Output}]},e}(),b=function(){function a(){}return a.setErrorUntilChanged=function(e,n,t){void 0===t&&(t=!0);var r={};r[n]=t,e.setErrors(r),e.valueChanges.pipe(o.take(1)).subscribe(function(){a.clearError(e,n)})},a.clearError=function(n,t){var r={};n.errors&&(Object.keys(n.errors).forEach(function(e){e!==t&&(r[e]=n.errors[e])}),0===Object.keys(r).length?n.setErrors(null):n.setErrors(r))},a.requiredNonEmpty=function(e){var n=e.value;return"string"!=typeof n?null:0===n.trim().length?{required:!0}:null},a}(),v=function(){function e(e,n,t){this._afAuth=e,this._authService=n,this._ngZone=t,this.oAuthProviderIds=[],this.emailChange=new a.EventEmitter,this.rememberChange=new a.EventEmitter,this.success=new a.EventEmitter,this.error=new a.EventEmitter,this.formId="ngx-firebase-auth-sign-in-methods-form-",this.submitting=!1,this.getOAuthProviderIcon=h,this.getOAuthProviderName=m,this.methodsForEmail={status:"unfetched",methods:[],email:null}}return Object.defineProperty(e.prototype,"auth",{get:function(){return this._afAuth.auth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"authService",{get:function(){return this._authService},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"methods",{get:function(){return this.methodsForEmail.methods},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fetchStatus",{get:function(){return this.methodsForEmail.status},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"methodsFetched",{get:function(){return"fetched"===this.methodsForEmail.status},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"accountIsNew",{get:function(){return this.methodsFetched&&0===this.methods.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"accountExists",{get:function(){return this.methodsFetched&&0<this.methods.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"accountHasPassword",{get:function(){return this.accountExists&&-1!==this.methods.indexOf("password")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"accountOAuthMethods",{get:function(){return this.accountExists?this.methods.filter(function(e){return"password"!==e}):[]},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.emailFc=new u.FormControl(this.email,{validators:[u.Validators.required,u.Validators.email]}),this.rememberFc=new u.FormControl(this.remember),this.rememberFc.valueChanges.subscribe(function(){return e.rememberChange.emit(e.rememberFc.value)}),this.fg=new u.FormGroup({email:this.emailFc,remember:this.rememberFc}),this.emailFc.valueChanges.subscribe(function(){return e.emailChange.emit(e.emailFc.value.trim())}),this.emailFc.valueChanges.pipe(o.debounceTime(500)).subscribe(function(){return e.fetch()}),this.fetch()},e.prototype.ngAfterViewInit=function(){this.emailInput.nativeElement.focus()},e.prototype.fetch=function(){var n=this,t=this.emailFc.value.trim();t!==this.methodsForEmail.email&&"fetching"!==this.methodsForEmail.status&&(this.methodsForEmail={status:"fetching",methods:[],email:t},this.emailFc.invalid?this.methodsForEmail={status:"unfetched",methods:[],email:t}:this.auth.fetchSignInMethodsForEmail(t).then(function(e){n.methodsForEmail={status:"fetched",methods:e,email:t}})["catch"](function(e){switch(n.emailFc.markAsDirty(),n.emailFc.markAsTouched(),e.code){case"auth/invalid-email":b.setErrorUntilChanged(n.emailFc,e.code)}n.methodsForEmail={email:n.email,status:"unfetched",methods:[]}}))},e.decorators=[{type:a.Component,args:[{selector:"ngx-firebase-auth-sign-in-methods-form",template:'<form [formGroup]="fg">\n  <div class="form-group">\n    <label [attr.for]="formId + \'email\'">Email Address</label>\n    <input\n      #emailInput\n      [attr.id]="formId + \'email\'"\n      [attr.aria-describedby]="formId + \'email\'"\n      type="email"\n      autocomplete="email"\n      placeholder="Email Address"\n      formControlName="email"\n      (blur)="fetch()"\n      (keyup.enter)="emailInput.blur()"\n      class="form-control"\n      [class.is-invalid]="emailFc.touched && emailFc.invalid">\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.touched && emailFc.hasError(\'required\')">\n      Required.\n    </div>\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.touched && emailFc.hasError(\'email\')">\n      Invalid email.\n    </div>\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.touched && emailFc.hasError(\'auth/invalid-email\')">\n      Invalid email.\n    </div>\n    <small class="text-muted form-text" [attr.id]="formId + \'email\'" [ngSwitch]="fetchStatus">\n      <span *ngSwitchCase="\'unfetched\'" [@fadeInOut]="\'in\'">\n        To get started, enter your email address.\n        If you don’t yet have an account we’ll create one for you.\n      </span>\n      <span *ngSwitchCase="\'fetching\'" [@fadeInOut]="\'in\'">\n        <i class="fas fa-spin fa-spinner fa-fw" aria-hidden="true"></i>\n        Looking up account...\n      </span>\n      <span *ngSwitchCase="\'fetched\'" [@fadeInOut]="\'in\'">\n        <i class="fas fa-check fa-fw text-success" aria-hidden="true"></i>\n        <span *ngIf="accountExists">Account found.</span>\n        <span *ngIf="accountIsNew">We\'ll create an account.</span>\n      </span>\n    </small>\n  </div>\n  <div class="form-group">\n    <div class="form-check">\n      <input\n        class="form-check-input"\n        type="checkbox"\n        [value]="true"\n        formControlName="remember"\n        [attr.id]="formId + \'remember\'">\n      <label class="form-check-label" [attr.for]="formId + \'remember\'">\n        Remember me on this device.\n      </label>\n    </div>\n  </div>\n</form>\n<div *ngIf="methodsFetched && accountExists" [@screen]="\'in\'">\n  <small class="text-muted mb-1 form-text">\n    <span *ngIf="accountHasPassword">\n      <span *ngIf="accountOAuthMethods.length === 0">\n        Please sign in with your password...\n      </span>\n      <span *ngIf="accountOAuthMethods.length === 1">\n        Please sign in with your password or your\n        linked {{getOAuthProviderName(accountOAuthMethods[0])}} account...\n      </span>\n      <span *ngIf="accountOAuthMethods.length > 1">\n        Please sign in with your password or one of your linked accounts...\n      </span>\n    </span>\n    <span *ngIf="!accountHasPassword">\n      <span *ngIf="accountOAuthMethods.length === 1">\n        Please sign in with your\n        linked {{getOAuthProviderName(accountOAuthMethods[0])}} account...\n      </span>\n      <span *ngIf="accountOAuthMethods.length > 1">\n        Please sign in with one of your linked accounts...\n      </span>\n    </span>\n\n  </small>\n\n  <div class="list-group">\n    <a\n      *ngIf="accountHasPassword"\n      routerLink="."\n      [queryParams]="{action: \'signInPassword\'}"\n      class="list-group-item list-group-item-action">\n      <i class="fas fa-lock fa-fw" aria-hidden="true"></i>\n      <span class="ml-2">\n        Sign In with Your Password\n      </span>\n    </a>\n    <a\n      *ngFor="let id of accountOAuthMethods"\n      routerLink="."\n      [queryParams]="{action: \'signInOAuth\', providerId: id}"\n      class="list-group-item list-group-item-action">\n      <i [attr.class]="getOAuthProviderIcon(id)" aria-hidden="true"></i>\n      <span class="ml-2">\n        Sign In with {{getOAuthProviderName(id)}}\n      </span>\n    </a>\n  </div>\n</div>\n\n<div *ngIf="methodsFetched && accountIsNew" [@screen]="\'in\'">\n  <small class="text-muted mb-1 form-text">\n    <span *ngIf="oAuthProviderIds.length === 0">\n      Please create an account...\n    </span>\n    <span *ngIf="oAuthProviderIds.length === 1">\n      Please sign up with your\n      {{getOAuthProviderName(oAuthProviderIds[0])}} account,\n      or create a separate account with a password....\n    </span>\n    <span *ngIf="oAuthProviderIds.length >1">\n      Please sign up with one of the services listed below,\n      or create a separate account with a password....\n    </span>\n  </small>\n  <div class="list-group">\n\n    <a\n      *ngFor="let id of oAuthProviderIds"\n      routerLink="."\n      [queryParams]="{action: \'signInOAuth\', providerId: id}"\n      class="list-group-item list-group-item-action">\n      <i [attr.class]="getOAuthProviderIcon(id)" aria-hidden="true"></i>\n      <span class="ml-2">\n        Sign Up with {{getOAuthProviderName(id)}}\n      </span>\n    </a>\n    <a\n      routerLink="."\n      [queryParams]="{action: \'signUpPassword\'}"\n      class="list-group-item list-group-item-action">\n      <i class="fas fa-lock fa-fw" aria-hidden="true"></i>\n      <span class="ml-2">\n        Create\n        <span *ngIf="oAuthProviderIds.length > 0">\n          a Separate\n        </span>\n        Account\n      </span>\n    </a>\n  </div>\n</div>\n',styles:[""],animations:[d,l]}]}],e.ctorParameters=function(){return[{type:t.AngularFireAuth},{type:p},{type:a.NgZone}]},e.propDecorators={emailInput:[{type:a.ViewChild,args:["emailInput"]}],email:[{type:a.Input}],remember:[{type:a.Input}],oAuthProviderIds:[{type:a.Input}],emailChange:[{type:a.Output}],rememberChange:[{type:a.Output}],success:[{type:a.Output}],error:[{type:a.Output}]},e}(),w=function(){function e(e,n){this._afAuth=e,this._authService=n,this.rememberChange=new a.EventEmitter,this.success=new a.EventEmitter,this.error=new a.EventEmitter,this.formId="ngx-firebase-auth-sign-in-form-",this.submitting=!1,this.methodsForEmail=[],this.getOAuthProviderIcon=h,this.getOAuthProviderName=m}return Object.defineProperty(e.prototype,"auth",{get:function(){return this._afAuth.auth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"authService",{get:function(){return this._authService},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var n=this;this.emailFc=new u.FormControl(this.email,{validators:[u.Validators.required,u.Validators.email]}),this.passwordFc=new u.FormControl("",{validators:[u.Validators.required]}),this.rememberFc=new u.FormControl(this.remember),this.rememberFc.valueChanges.subscribe(function(e){return n.rememberChange.emit(e)}),this.fg=new u.FormGroup({email:this.emailFc,password:this.passwordFc,remember:this.rememberFc})},e.prototype.ngAfterViewInit=function(){this.passwordInput.nativeElement.focus()},e.prototype.submit=function(){var n,t=this,r=this.emailFc.value.trim();this.submitting=!0,this.methodsForEmail=[],this.auth.fetchSignInMethodsForEmail(r).then(function(e){return 0===(t.methodsForEmail=e).length?Promise.reject({code:"auth/user-not-found"}):-1===e.indexOf("password")?Promise.reject({code:"ngx-firebase-auth/no-password"}):t.auth.signInWithEmailAndPassword(r,t.passwordFc.value)}).then(function(e){return n=e,t.authService.setRemembered(!0===t.rememberFc.value,r)}).then(function(){t.success.emit(n)})["catch"](function(e){switch(t.submitting=!1,t.emailFc.markAsDirty(),t.emailFc.markAsTouched(),t.passwordFc.markAsDirty(),t.passwordFc.markAsTouched(),e.code){case"auth/invalid-email":case"auth/user-not-found":case"auth/user-disabled":case"ngx-firebase-auth/no-password":b.setErrorUntilChanged(t.emailFc,e.code);break;case"auth/wrong-password":b.setErrorUntilChanged(t.passwordFc,e.code);break;default:t.error.emit(e)}})},e.decorators=[{type:a.Component,args:[{selector:"ngx-firebase-auth-sign-in-form",template:'<form [formGroup]="fg" (ngSubmit)="submit()">\n\n  <div class="form-group">\n    <label [attr.for]="formId + \'email\'">Email Address</label>\n\n    <input\n      readonly\n      #emailInput\n      [attr.id]="formId + \'email\'"\n      [attr.aria-describedby]="formId + \'email\'"\n      type="email"\n      autocomplete="email"\n      placeholder="Email Address"\n      formControlName="email"\n      class="form-control">\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.hasError(\'required\')">\n      Required.\n    </div>\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.hasError(\'email\')">\n      Invalid email.\n    </div>\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.hasError(\'auth/invalid-email\')">\n      Invalid email.\n    </div>\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.hasError(\'auth/user-not-found\')">\n      We could not find an account with that email address.\n      <a routerLink="." [queryParams]="{action: \'signIn\'}">Create Account</a>\n    </div>\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.hasError(\'auth/user-disabled\')">\n      The account with that email address has been disabled.\n    </div>\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.hasError(\'ngx-firebase-auth/no-password\')">\n      The account with that email address does not have a password.\n      Please sign in using:\n      <span *ngFor="let id of methodsForEmail; let isLast = last">\n        <a routerLink="." [queryParams]="{action: \'signInOAuth\', providerId: id}">{{getOAuthProviderName(id)}}</a>\n        <span *ngIf="!isLast">\n          |\n        </span>\n      </span>\n    </div>\n\n    <small class="text-muted form-text" [attr.id]="formId + \'email\'" >\n      Not your email address?\n      <a routerLink="." [queryParams]="{action: \'signIn\'}">Start Over</a>\n    </small>\n  </div>\n\n\n  <div class="form-group">\n    <div class="d-flex justify-content-between align-items-end">\n      <label [attr.for]="formId + \'password\'">Password</label>\n      <small>\n        <a (click)="$event.preventDefault(); passwordInput.type = \'password\' === passwordInput.type  ? \'text\' : \'password\'"\n          href="#" tabindex="-1" class="d-inline-block">\n          <span *ngIf="\'password\' === passwordInput.type">Show</span>\n          <span *ngIf="\'text\' === passwordInput.type">Hide</span>\n        </a>\n      </small>\n    </div>\n    <input\n      #passwordInput\n      [attr.id]="formId + \'password\'"\n      [attr.aria-describedby]="formId + \'password-help\'"\n      type="password"\n      formControlName="password"\n      placeholder="Password"\n      autocomplete="password"\n      class="form-control"\n      [class.is-invalid]="passwordFc.touched && passwordFc.invalid">\n    <div class="invalid-feedback"\n      *ngIf="passwordFc.touched && passwordFc.hasError(\'required\')"\n      [@fadeInOut]="\'in\'">\n      Required.\n    </div>\n    <div class="invalid-feedback"\n      *ngIf="passwordFc.touched && passwordFc.hasError(\'auth/wrong-password\')"\n      [@fadeInOut]="\'in\'">\n      Wrong password.\n    </div>\n    <small [attr.id]="formId + \'password-help\'" class="form-text text-muted">\n      Forgot? <a routerLink="." [queryParams]="{action: \'resetPassword\'}">Reset Password</a>\n    </small>\n  </div>\n  <div class="form-group">\n    <div class="form-check">\n      <input\n        class="form-check-input"\n        type="checkbox"\n        [value]="true"\n        formControlName="remember"\n        [attr.id]="formId + \'remember\'">\n      <label class="form-check-label" [attr.for]="formId + \'remember\'">\n        Remember me on this device.\n      </label>\n    </div>\n  </div>\n  <div class="form-group">\n    <button type="submit"\n      class="btn btn-success btn-block"\n      [disabled]="fg.invalid || submitting">\n      <i class="fas fa-lock fa-fw" aria-hidden="true"></i>\n      Sign In\n    </button>\n  </div>\n</form>\n',styles:[""],animations:[d]}]}],e.ctorParameters=function(){return[{type:t.AngularFireAuth},{type:p}]},e.propDecorators={passwordInput:[{type:a.ViewChild,args:["passwordInput"]}],email:[{type:a.Input}],remember:[{type:a.Input}],rememberChange:[{type:a.Output}],success:[{type:a.Output}],error:[{type:a.Output}]},e}(),y=function(){function e(e,n){this._afAuth=e,this._authService=n,this.rememberChange=new a.EventEmitter,this.success=new a.EventEmitter,this.error=new a.EventEmitter,this.formId="ngx-firebase-auth-sign-up-form-",this.submitting=!1}return Object.defineProperty(e.prototype,"auth",{get:function(){return this._afAuth.auth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"authService",{get:function(){return this._authService},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var n=this;this.emailFc=new u.FormControl(this.email,{validators:[u.Validators.required,u.Validators.email]}),this.passwordFc=new u.FormControl("",{validators:[u.Validators.required]}),this.nameFc=new u.FormControl("",{validators:[u.Validators.required,b.requiredNonEmpty]}),this.rememberFc=new u.FormControl(this.remember),this.rememberFc.valueChanges.subscribe(function(e){return n.rememberChange.emit(e)}),this.fg=new u.FormGroup({email:this.emailFc,password:this.passwordFc,name:this.nameFc,remember:this.rememberFc})},e.prototype.ngAfterViewInit=function(){this.passwordInput.nativeElement.focus()},e.prototype.submit=function(){var n,t=this;this.submitting=!0,this.auth.fetchSignInMethodsForEmail(this.email).then(function(e){return 0<e.length?Promise.reject({code:"ngx-firebase-auth/account-exists"}):t.auth.createUserWithEmailAndPassword(t.email,t.passwordFc.value)}).then(function(e){return(n=e).user.updateProfile({displayName:t.nameFc.value.trim(),photoURL:null})}).then(function(){return t.authService.setRemembered(!0===t.rememberFc.value,t.email)}).then(function(){t.success.emit(n)})["catch"](function(e){switch(t.submitting=!1,t.emailFc.markAsDirty(),t.emailFc.markAsTouched(),t.passwordFc.markAsDirty(),t.passwordFc.markAsTouched(),e.code){case"auth/invalid-email":case"ngx-firebase-auth/account-exists":b.setErrorUntilChanged(t.emailFc,e.code);break;case"auth/weak-password":b.setErrorUntilChanged(t.passwordFc,e.code);break;default:t.error.emit(e)}})},e.decorators=[{type:a.Component,args:[{selector:"ngx-firebase-auth-sign-up-form",template:'<form [formGroup]="fg" (ngSubmit)="submit()">\n  <div class="form-group">\n    <label [attr.for]="formId + \'email\'">Email Address</label>\n    <input\n      readonly\n      #emailInput\n      [attr.id]="formId + \'email\'"\n      [attr.aria-describedby]="formId + \'email\'"\n      type="email"\n      autocomplete="email"\n      placeholder="Email Address"\n      formControlName="email"\n      class="form-control">\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.hasError(\'required\')">\n      Required.\n    </div>\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.hasError(\'email\')">\n      Invalid email.\n    </div>\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.hasError(\'auth/invalid-email\')">\n      Invalid email.\n    </div>\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.hasError(\'ngx-firebase-auth/account-exists\')">\n      We found an account with that email address.\n      <a routerLink="." [queryParams]="{action: \'signIn\'}">Sign In</a>\n    </div>\n    <small class="text-muted form-text" [attr.id]="formId + \'email\'" >\n      Not your email address?\n      <a routerLink="." [queryParams]="{action: \'signIn\'}">Go Back</a>\n    </small>\n  </div>\n\n  <div class="form-group">\n    <div class="d-flex justify-content-between align-items-end">\n      <label [attr.for]="formId + \'password\'">Choose Password</label>\n      <small>\n        <a (click)="$event.preventDefault(); passwordInput.type = \'password\' === passwordInput.type  ? \'text\' : \'password\'"\n          href="#" tabindex="-1" class="d-inline-block">\n          <span *ngIf="\'password\' === passwordInput.type">Show</span>\n          <span *ngIf="\'text\' === passwordInput.type">Hide</span>\n        </a>\n      </small>\n    </div>\n    <input\n      #passwordInput\n      [attr.id]="formId + \'password\'"\n      [attr.aria-describedby]="formId + \'password-help\'"\n      type="password"\n      formControlName="password"\n      placeholder="Choose Password"\n      autocomplete="password"\n      class="form-control"\n      [class.is-invalid]="passwordFc.touched && passwordFc.invalid">\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="passwordFc.touched && passwordFc.hasError(\'required\')">\n      Required.\n    </div>\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="passwordFc.touched && passwordFc.hasError(\'auth/wrong-password\')">\n      Wrong password.\n    </div>\n    <small [attr.id]="formId + \'password-help\'" class="form-text text-muted">\n      Please choose a strong password.\n    </small>\n  </div>\n  <div class="form-group">\n    <label [attr.for]="formId + \'name\'">Your Name</label>\n    <input\n      [attr.id]="formId + \'name\'"\n      type="text"\n      formControlName="name"\n      placeholder="Your Name"\n      class="form-control"\n      [class.is-invalid]="nameFc.touched && nameFc.invalid">\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="nameFc.touched && nameFc.hasError(\'required\')">\n      Required.\n    </div>\n  </div>\n  <div class="form-group">\n    <div class="form-check">\n      <input\n        class="form-check-input"\n        type="checkbox"\n        [value]="true"\n        formControlName="remember"\n        [attr.id]="formId + \'remember\'">\n      <label class="form-check-label" [attr.for]="formId + \'remember\'">\n        Remember me on this device.\n      </label>\n    </div>\n  </div>\n  <div class="form-group">\n    <button type="submit"\n      class="btn btn-success btn-block"\n      [disabled]="fg.invalid || submitting">\n      <i class="fas fa-lock fa-fw" aria-hidden="true"></i>\n      Create Account\n    </button>\n  </div>\n</form>\n',styles:[""],animations:[d]}]}],e.ctorParameters=function(){return[{type:t.AngularFireAuth},{type:p}]},e.propDecorators={passwordInput:[{type:a.ViewChild,args:["passwordInput"]}],email:[{type:a.Input}],remember:[{type:a.Input}],rememberChange:[{type:a.Output}],success:[{type:a.Output}],error:[{type:a.Output}]},e}(),I=function(){function e(e){this._afAuth=e,this.emailChange=new a.EventEmitter,this.error=new a.EventEmitter,this.formId="ngx-firebase-auth-reset-password-send-form-",this.submitting=!1,this.sent=null}return Object.defineProperty(e.prototype,"auth",{get:function(){return this._afAuth.auth},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.emailFc=new u.FormControl(this.email,{validators:[u.Validators.required,u.Validators.email]}),this.emailFc.valueChanges.subscribe(function(){return e.emailChange.emit(e.emailFc.value.trim())}),this.fg=new u.FormGroup({email:this.emailFc})},e.prototype.ngAfterViewInit=function(){this.emailInput.nativeElement.focus()},e.prototype.submit=function(){var n=this,e=this.emailFc.value.trim();this.submitting=!0,this.sent=null,this.auth.sendPasswordResetEmail(e).then(function(){n.submitting=!1,n.sent=e})["catch"](function(e){switch(n.submitting=!1,n.emailFc.markAsTouched(),n.emailFc.markAsDirty(),e.code){case"auth/invalid-email":case"auth/user-not-found":b.setErrorUntilChanged(n.emailFc,e.code);break;default:n.error.emit(e)}})},e.decorators=[{type:a.Component,args:[{selector:"ngx-firebase-auth-reset-password-send-form",template:'<form [formGroup]="fg" (ngSubmit)="submit()">\n  <div *ngIf="sent" [@fadeInOut]="\'in\'">\n    <div class="alert alert-success">\n      <i class="fas fa-check fa-fw" aria-hidden="true"></i>\n      We’ve sent a reset password link to {{sent}}.\n      Please allow a few moments for the email to arrive.\n    </div>\n  </div>\n\n  <div class="form-group">\n    <label [attr.for]="formId + \'email\'">Email Address</label>\n    <input\n      #emailInput\n      [attr.id]="formId + \'email\'"\n      [attr.aria-describedby]="formId + \'email-help\'"\n      type="email"\n      formControlName="email"\n      class="form-control"\n      [class.is-invalid]="emailFc.touched && emailFc.invalid">\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.touched && emailFc.hasError(\'required\')">\n      Required.\n    </div>\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.touched && emailFc.hasError(\'auth/user-not-found\')">\n      We could not find an account with that email address.\n      Please <a routerLink="." [queryParams]="{action: \'signIUpPassword\'}">sign up</a>.\n    </div>\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.touched && emailFc.hasError(\'email\')">\n      Invalid email.\n    </div>\n    <div class="invalid-feedback" [@fadeInOut]="\'in\'"\n      *ngIf="emailFc.touched && emailFc.hasError(\'auth/invalid-email\')">\n      Invalid email.\n    </div>\n    <small [attr.id]="formId + \'email-help\'" class="form-text text-muted">\n      Enter the email address you used to sign up. We’ll\n      send a reset password link to that address.\n    </small>\n  </div>\n  <div class="form-group">\n    <button type="submit"\n      class="btn btn-block btn-success"\n      [disabled]="fg.invalid || submitting">\n      <i class="fas fa-fw fa-envelope" aria-hidden="true"></i>\n      Send Link\n    </button>\n  </div>\n</form>\n',styles:[""],animations:[d]}]}],e.ctorParameters=function(){return[{type:t.AngularFireAuth}]},e.propDecorators={emailInput:[{type:a.ViewChild,args:["emailInput"]}],email:[{type:a.Input}],emailChange:[{type:a.Output}],error:[{type:a.Output}]},e}(),P=function(){function e(e,n,t,r){this._afAuth=e,this._svc=n,this._route=t,this._router=r,this.success=new a.EventEmitter,this.emailChange=new a.EventEmitter,this.rememberChange=new a.EventEmitter,this.error=new a.EventEmitter,this.screen="wait",this.methodError=null,this.getOAuthProviderIcon=h,this.getOAuthProviderName=m,this.formId="ngx-firebase-auth-sign-in-oauth-"}return Object.defineProperty(e.prototype,"auth",{get:function(){return this._afAuth.auth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"authService",{get:function(){return this._svc},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"route",{get:function(){return this._route},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"router",{get:function(){return this._router},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var n=this;this.rememberFc=new u.FormControl(this.remember),this.rememberFc.valueChanges.subscribe(function(e){return n.rememberChange.emit(e)}),this.fg=new u.FormGroup({remember:this.rememberFc}),this.initialError?this.handleOAuthError(this.initialError):this.oAuthSignIn(this.providerId)},e.prototype.oAuthSignIn=function(n,e){var t,r=this;this.methodError=null,this.useOAuthPopup&&!0!==e?this.getOAuthProvider(n).then(function(e){return r.auth.signInWithPopup(e)}).then(function(e){return t=e,r.authService.setRemembered(!0===r.rememberFc.value,e.user.email)}).then(function(){r.success.emit(t)})["catch"](function(e){return r.handleOAuthError(e,n)}):this.router.navigate(["."],{relativeTo:this.route,queryParams:{remember:!0===this.rememberFc.value}}).then(function(){return r.getOAuthProvider(n)}).then(function(e){return r.auth.signInWithRedirect(e)})["catch"](function(e){return r.handleOAuthError(e,n)})},e.prototype.handleOAuthError=function(n,e){var t=this;if(n.email&&n.credential)return this.emailChange.emit(n.email),void this.auth.fetchSignInMethodsForEmail(n.email).then(function(e){n.methods=e,n.accountHasPassword=-1!==e.indexOf("password"),n.accountOAuthMethods=e.filter(function(e){return"password"!==e}),t.methodError=n,t.screen="methodError"});switch(n.code){case"auth/cancelled-popup-request":case"auth/popup-closed-by-user":this.screen="retry";break;case"auth/popup-blocked":this.oAuthSignIn(e,!0);break;default:this.error.emit(n)}},e.prototype.getOAuthProvider=function(e){var n=null;if(this.oAuthProviderFactory&&(n=this.oAuthProviderFactory(e)),!n)switch(e){case"twitter.com":n=new i.auth.TwitterAuthProvider;break;case"facebook.com":n=new i.auth.FacebookAuthProvider;break;case"google.com":n=new i.auth.GoogleAuthProvider;break;case"github.com":n=new i.auth.GithubAuthProvider}return n?Promise.resolve(n):Promise.reject({code:"ngx-firebase-auth/no-provider-found",message:'We could not create an OAuth provider for provider id "'+e+'".'})},e.decorators=[{type:a.Component,args:[{selector:"ngx-firebase-auth-sign-in-oauth",template:'<div *ngIf="\'wait\' === screen" [@screen]="\'in\'">\n  <div class="alert alert-secondary">\n    <i class="fas fa-spin fa-spinner fa-fw" aria-hidden="true"></i>\n    Please wait...\n  </div>\n</div>\n\n<div *ngIf="\'methodError\' === screen" [@screen]="\'in\'">\n  <div class="alert alert-danger">\n    <i class="fas fa-exclamation-triangle fa-fw" aria-hidden="true"></i>\n    We could not sign you in with {{methodError.credential.providerId}}.\n  </div>\n\n  <p class="text-muted">\n    Please sign in with one of the methods associated with\n    {{methodError.email}}:\n  </p>\n\n  <div class="list-group">\n    <a\n      *ngIf="methodError.accountHasPassword"\n      routerLink="."\n      [queryParams]="{action: \'signInPassword\'}"\n      class="list-group-item list-group-item-action">\n      <i class="fas fa-unlock" aria-hidden="true"></i>\n      <span class="ml-2">Sign In with Your Password</span>\n    </a>\n    <button\n      *ngFor="let id of methodError.accountOAuthMethods"\n      (click)="oAuthSignIn(id)"\n      class="list-group-item list-group-item-action">\n      <i [attr.class]="getOAuthProviderIcon(id)" aria-hidden="true"></i>\n      <span class="ml-2">Sign In with {{getOAuthProviderName(id)}}</span>\n    </button>\n  </div>\n\n  <form [formGroup]="fg">\n    <div class="form-group">\n      <div class="form-check">\n        <input\n          class="form-check-input"\n          type="checkbox"\n          [value]="true"\n          formControlName="remember"\n          [attr.id]="formId + \'remember\'">\n        <label class="form-check-label" [attr.for]="formId + \'remember\'">\n          Remember me on this device.\n        </label>\n      </div>\n    </div>\n  </form>\n\n  <p class="text-muted">\n    Is {{methodError.email}} not your email address?\n    <a routerLink="." [queryParams]="{action: \'signIn\'}">Start Over</a>\n  </p>\n\n</div>\n\n<div *ngIf="\'retry\' === screen" [@screen]="\'in\'">\n  <div class="alert alert-danger">\n    <i class="fas fa-exclamation-triangle fa-fw" aria-hidden="true"></i>\n    It looks like you cancelled signing in with\n    {{getOAuthProviderName(providerId)}}. Try again:\n  </div>\n\n  <div class="list-group">\n    <button\n      (click)="oAuthSignIn(providerId)"\n      class="list-group-item list-group-item-action">\n      <i [attr.class]="getOAuthProviderIcon(providerId)" aria-hidden="true"></i>\n      <span class="ml-2">Sign In with {{getOAuthProviderName(providerId)}}</span>\n    </button>\n  </div>\n\n  <form [formGroup]="fg">\n    <div class="form-group">\n      <div class="form-check">\n        <input\n          class="form-check-input"\n          type="checkbox"\n          [value]="true"\n          formControlName="remember"\n          [attr.id]="formId + \'remember\'">\n        <label class="form-check-label" [attr.for]="formId + \'remember\'">\n          Remember me on this device.\n        </label>\n      </div>\n    </div>\n  </form>\n\n\n  <p class="text-muted">\n    <a routerLink="." [queryParams]="{action: \'signIn\'}">Start Over</a>\n  </p>\n\n</div>\n',styles:[""],animations:[l]}]}],e.ctorParameters=function(){return[{type:t.AngularFireAuth},{type:p},{type:r.ActivatedRoute},{type:r.Router}]},e.propDecorators={providerId:[{type:a.Input}],initialError:[{type:a.Input}],useOAuthPopup:[{type:a.Input}],oAuthProviderFactory:[{type:a.Input}],email:[{type:a.Input}],remember:[{type:a.Input}],success:[{type:a.Output}],emailChange:[{type:a.Output}],rememberChange:[{type:a.Output}],error:[{type:a.Output}]},e}(),F=function(){function e(){}return e.decorators=[{type:a.NgModule,args:[{imports:[c.CommonModule],providers:[p]}]}],e}(),O=function(){function e(){}return e.decorators=[{type:a.NgModule,args:[{imports:[c.CommonModule,u.ReactiveFormsModule,r.RouterModule,F],declarations:[f,v,w,y,I,P],exports:[f]}]}],e}(),E=function(){function e(e,n){this._afAuth=e,this._authService=n,this.success=new a.EventEmitter,this.screen="wait",this.submitting=!1,this.formId="ngx-firebase-auth-oob-reset-password-",this.unhandledError=null,this.cred=null}return Object.defineProperty(e.prototype,"auth",{get:function(){return this._afAuth.auth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"authService",{get:function(){return this._authService},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var n=this,e=this.authService.getRemembered();this.emailFc=new u.FormControl(""),this.passwordFc=new u.FormControl("",{validators:[u.Validators.required]}),this.rememberFc=new u.FormControl(e.remember),this.fg=new u.FormGroup({email:this.emailFc,password:this.passwordFc,remember:this.rememberFc}),this.auth.checkActionCode(this.oobCode).then(function(e){n.info=e,n.emailFc.setValue(e.data.email),n.screen="form"})["catch"](function(e){n.unhandledError=e,n.screen="error"})},e.prototype.submit=function(){var n=this;this.submitting=!0,this.auth.confirmPasswordReset(this.oobCode,this.passwordFc.value).then(function(){return n.auth.signInWithEmailAndPassword(n.info.data.email,n.passwordFc.value)}).then(function(e){return n.cred=e,n.authService.setRemembered(!0===n.rememberFc.value,n.info.data.email)}).then(function(){n.screen="success",n.success.emit({mode:"resetPassword",info:n.info,cred:n.cred,user:n.cred.user})})["catch"](function(e){switch(n.submitting=!1,n.passwordFc.markAsDirty(),n.passwordFc.markAsTouched(),e.code){case"auth/weak-password":b.setErrorUntilChanged(n.passwordFc,e.code);break;default:n.unhandledError=e,n.screen="error"}})},e.decorators=[{type:a.Component,args:[{selector:"ngx-firebase-auth-oob-reset-password",template:'<div *ngIf="\'wait\' === screen" [@screen]="\'in\'">\n  <div class="alert alert-secondary">\n    <i class="fas fa-spin fa-spinner fa-fw" aria-hidden="true"></i>\n    Please wait...\n  </div>\n</div>\n\n<div *ngIf="\'success\' === screen" [@screen]="\'in\'">\n  <div class="alert alert-success">\n    <i class="fas fa-check fa-fw" aria-hidden="true"></i>\n    Welcome, {{cred.user.displayName}}!\n    Your new password has been saved and you are signed in.\n  </div>\n</div>\n\n<div *ngIf="screen === \'error\'" [@screen]="\'in\'">\n  <div class="alert alert-danger">\n    <p>\n      <i class="fas fa-exclamation-triangle fa-fw" aria-hidden="true"></i>\n      Woops! An error occurred.\n    </p>\n    <div [ngSwitch]="unhandledError.code">\n      <p class="mb-0" *ngSwitchCase="\'auth/expired-action-code\'">\n        The reset password link you used has expired.\n      </p>\n      <p class="mb-0" *ngSwitchCase="\'auth/invalid-action-code\'">\n        The reset password link you used is not valid. This may be because it\n        has already been used.\n      </p>\n      <p class="mb-0" *ngSwitchCase="\'auth/user-disabled\'">\n        The account associated with the reset password link you used has been disabled.\n      </p>\n      <p class="mb-0" *ngSwitchCase="\'auth/user-not-found\'">\n        The account associated with the reset password link you used has been removed.\n      </p>\n      <div *ngSwitchDefault>\n        <p>Code: {{unhandledError.code}}</p>\n        <p class="mb-0">\n          Message: {{unhandledError.message}}\n        </p>\n      </div>\n    </div>\n  </div>\n</div>\n\n\n<div *ngIf="\'form\' === screen" [@screen]="\'in\'">\n  <form [formGroup]="fg" (ngSubmit)="submit()">\n    <div class="form-group">\n      <label [attr.for]="formId + \'email\'">Email Address</label>\n\n      <input\n        readonly\n        #emailInput\n        [attr.id]="formId + \'email\'"\n        [attr.aria-describedby]="formId + \'email\'"\n        type="email"\n        autocomplete="email"\n        placeholder="Email Address"\n        formControlName="email"\n        class="form-control">\n      <small class="text-muted form-text" [attr.id]="formId + \'email\'" >\n        You are resetting the password for {{emailFc.value}}.\n      </small>\n    </div>\n\n    <div class="form-group">\n      <div class="d-flex justify-content-between align-items-end">\n        <label [attr.for]="formId + \'password\'">Password</label>\n        <small>\n          <a (click)="$event.preventDefault(); passwordInput.type = \'password\' === passwordInput.type  ? \'text\' : \'password\'"\n            href="#" tabindex="-1" class="d-inline-block">\n            <span *ngIf="\'password\' === passwordInput.type">Show</span>\n            <span *ngIf="\'text\' === passwordInput.type">Hide</span>\n          </a>\n        </small>\n      </div>\n      <input\n        #passwordInput\n        [attr.id]="formId + \'password\'"\n        [attr.aria-describedby]="formId + \'password-help\'"\n        type="password"\n        formControlName="password"\n        placeholder="Password"\n        autocomplete="password"\n        class="form-control"\n        [class.is-invalid]="passwordFc.touched && passwordFc.invalid">\n      <div class="invalid-feedback" *ngIf="passwordFc.touched && passwordFc.hasError(\'required\')">\n        Required.\n      </div>\n      <div class="invalid-feedback" *ngIf="passwordFc.touched && passwordFc.hasError(\'auth/weak-password\')">\n        That password is too weak.\n      </div>\n      <small [attr.id]="formId + \'password-help\'" class="form-text text-muted">\n        Please choose a strong password.\n      </small>\n    </div>\n    <div class="form-group">\n      <div class="form-check">\n        <input\n          class="form-check-input"\n          type="checkbox"\n          [value]="true"\n          formControlName="remember"\n          [attr.id]="formId + \'remember\'">\n        <label class="form-check-label" [attr.for]="formId + \'remember\'">\n          Remember me on this device.\n        </label>\n      </div>\n    </div>\n    <div class="form-group">\n      <button type="submit"\n        class="btn btn-success btn-block"\n        [disabled]="fg.invalid || submitting">\n        <i class="fas fa-save fa-fw" aria-hidden="true"></i>\n        Save Password and Sign In\n      </button>\n    </div>\n  </form>\n</div>\n',styles:[""],animations:[l]}]}],e.ctorParameters=function(){return[{type:t.AngularFireAuth},{type:p}]},e.propDecorators={oobCode:[{type:a.Input}],success:[{type:a.Output}]},e}(),A=function(){function e(e){this._afAuth=e,this.success=new a.EventEmitter,this.screen="wait",this.submitting=!1}return Object.defineProperty(e.prototype,"auth",{get:function(){return this._afAuth.auth},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var n=this;this.auth.checkActionCode(this.oobCode).then(function(e){n.info=e,n.screen="form"})["catch"](function(e){n.unhandledError=e,n.screen="error"})},e.prototype.submit=function(){var n=this;this.auth.applyActionCode(this.oobCode).then(function(){n.screen="success",n.success.emit({mode:"recoverEmail",info:n.info,user:n.auth.currentUser})})["catch"](function(e){n.unhandledError=e,n.screen="error"})},e.decorators=[{type:a.Component,args:[{selector:"ngx-firebase-auth-oob-recover-email",template:'\n\n<div *ngIf="\'wait\' === screen" [@screen]="\'in\'">\n  <div class="alert alert-secondary">\n    <i class="fas fa-spin fa-spinner fa-fw" aria-hidden="true"></i>\n    Please wait...\n  </div>\n</div>\n\n\n<div *ngIf="\'success\' === screen" [@screen]="\'in\'">\n  <div class="alert alert-success">\n    <i class="fas fa-check fa-fw" aria-hidden="true"></i>\n    Your email has been changed back to {{info.data.email}};\n  </div>\n</div>\n\n<div *ngIf="screen === \'form\'" [@screen]="\'in\'">\n  <div class="form-group">\n    <p>\n      Are you sure you want to change your email back to\n      {{info.data.email}} from {{info.data.fromEmail}}?\n    </p>\n    <button\n      type="button"\n      [disabled]="submitting"\n      (click)="submit()"\n      class="btn btn-block btn-success">\n      <i class="fas fa-save fa-fw" aria-hidden="true"></i>\n      Yes, Continue\n    </button>\n  </div>\n</div>\n\n\n\n<div *ngIf="screen === \'error\'" [@screen]="\'in\'">\n  <div class="alert alert-danger">\n    <p>\n      <i class="fas fa-exclamation-triangle fa-fw" aria-hidden="true"></i>\n      Woops! An error occurred.\n    </p>\n    <div [ngSwitch]="unhandledError.code">\n      <p class="mb-0" *ngSwitchCase="\'auth/expired-action-code\'">\n        The recover email link you used has expired.\n      </p>\n      <p class="mb-0" *ngSwitchCase="\'auth/invalid-action-code\'">\n        The recover email link you used is not valid. This may be because it\n        has already been used.\n      </p>\n      <p class="mb-0" *ngSwitchCase="\'auth/user-disabled\'">\n        The account associated with the recover email link you used has been disabled.\n      </p>\n      <p class="mb-0" *ngSwitchCase="\'auth/user-not-found\'">\n        The account associated with the recover email link you used has been removed.\n      </p>\n      <div *ngSwitchDefault>\n        <p>Code: {{unhandledError.code}}</p>\n        <p class="mb-0">\n          Message: {{unhandledError.message}}\n        </p>\n      </div>\n    </div>\n  </div>\n</div>\n',styles:[""],animations:[l]}]}],e.ctorParameters=function(){return[{type:t.AngularFireAuth}]},e.propDecorators={oobCode:[{type:a.Input}],success:[{type:a.Output}]},e}(),k=function(){function e(e){this._afAuth=e,this.success=new a.EventEmitter,this.screen="wait",this.submitting=!1}return Object.defineProperty(e.prototype,"auth",{get:function(){return this._afAuth.auth},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var n=this;this.auth.checkActionCode(this.oobCode).then(function(e){return n.info=e,n.auth.applyActionCode(n.oobCode)}).then(function(){n.screen="success",n.success.emit({mode:"verifyEmail",info:n.info,user:n.auth.currentUser})})["catch"](function(e){n.unhandledError=e,n.screen="error"})},e.decorators=[{type:a.Component,args:[{selector:"ngx-firebase-auth-oob-verify-email",template:'<div *ngIf="\'wait\' === screen" [@screen]="\'in\'">\n  <div class="alert alert-secondary">\n    <i class="fas fa-spin fa-spinner fa-fw" aria-hidden="true"></i>\n    Please wait...\n  </div>\n</div>\n\n<div *ngIf="\'success\' === screen" [@screen]="\'in\'">\n  <div class="alert alert-success">\n    <i class="fas fa-check fa-fw" aria-hidden="true"></i>\n    The email {{info.data.email}} has been verified.\n  </div>\n</div>\n\n<div *ngIf="screen === \'error\'" [@screen]="\'in\'">\n  <div class="alert alert-danger">\n    <p>\n      <i class="fas fa-exclamation-triangle fa-fw" aria-hidden="true"></i>\n      Woops! An error occurred.\n    </p>\n    <div [ngSwitch]="unhandledError.code">\n      <p class="mb-0" *ngSwitchCase="\'auth/expired-action-code\'">\n        The verify email link you used has expired.\n      </p>\n      <p class="mb-0" *ngSwitchCase="\'auth/invalid-action-code\'">\n        The verify email link you used is not valid. This may be because it\n        has already been used.\n      </p>\n      <p class="mb-0" *ngSwitchCase="\'auth/user-disabled\'">\n        The account associated with the verify email link you used has been disabled.\n      </p>\n      <p class="mb-0" *ngSwitchCase="\'auth/user-not-found\'">\n        The account associated with the verify email link you used has been removed.\n      </p>\n      <div *ngSwitchDefault>\n        <p>Code: {{unhandledError.code}}</p>\n        <p class="mb-0">\n          Message: {{unhandledError.message}}\n        </p>\n      </div>\n    </div>\n  </div>\n</div>\n',styles:[""],animations:[l]}]}],e.ctorParameters=function(){return[{type:t.AngularFireAuth}]},e.propDecorators={oobCode:[{type:a.Input}],success:[{type:a.Output}]},e}(),x=function(){function e(){}return e.decorators=[{type:a.NgModule,args:[{imports:[c.CommonModule,u.ReactiveFormsModule,r.RouterModule,F],declarations:[g,A,E,k],exports:[g]}]}],e}();e.fadeInOutAnimation=d,e.screenAnimation=l,e.getOAuthProviderName=m,e.getOAuthProviderIcon=h,e.NgxFirebaseAuthService=p,e.SignInComponent=f,e.OobComponent=g,e.NgxFirebaseAuthSignInModule=O,e.NgxFirebaseAuthOobModule=x,e.NgxFirebaseAuthModule=F,e.ɵf=A,e.ɵg=E,e.ɵh=k,e.ɵd=I,e.ɵb=w,e.ɵa=v,e.ɵe=P,e.ɵc=y,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=nowzoo-ngx-firebase-auth.umd.min.js.map