Skip to content

Commit

Permalink
fix(package): path of config interface to support aot `@Inject(NgxAut…
Browse files Browse the repository at this point in the history
…hFirebaseUIConfigToken)`
  • Loading branch information
AnthonyNahas committed Jul 4, 2018
1 parent 8fec0a0 commit 61d1efa
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
17 changes: 13 additions & 4 deletions src/module/components/auth/auth.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<mat-tab-group [color]="color">
<!--Reset password tab-->
<mat-tab *ngIf="passwordResetWished" label="Reset Password">
<form [formGroup]="resetPasswordFormGroup" (ngSubmit)="resetPasswordFormGroup.valid && resetPassword()">

Expand Down Expand Up @@ -47,14 +48,17 @@
</mat-card>
</form>
</mat-tab>

<!--Sign in tab-->
<mat-tab label="Sign in">
<mat-card>
<mat-card-title>Signing in</mat-card-title>
<mat-card-content>
<form [formGroup]="signInFormGroup"
(ngSubmit)="signInFormGroup.valid &&
authProcess.signInWith
(authProviders.EmailAndPassword,signInFormGroup.value.email,signInFormGroup.value.password)">
<div fxLayout="column" fxLayoutAlign="center center">
<div fxLayout="column" fxLayoutAlign="center">
<mat-form-field appearance="outline">
<!--<mat-label>E-mail</mat-label>-->
<input matInput
Expand Down Expand Up @@ -127,11 +131,11 @@
<mat-card-title>Registration</mat-card-title>
<div *ngIf="!authProcess.emailConfirmationSent;then register else confirm"></div>
<ng-template #register>
<mat-card-content fxLayout="column" fxLayoutAlign="center center">
<mat-card-content fxLayout="column" fxLayoutAlign="center">
<form [formGroup]="signUpFormGroup" (ngSubmit)="signUpFormGroup.valid &&
authProcess.signUp
(signUpFormGroup.value.name,signUpFormGroup.value.email,signUpFormGroup.value.password)">
<div fxLayout="column" fxLayoutAlign="center center">
<div fxLayout="column" fxLayoutAlign="center">
<!--name-->
<mat-form-field appearance="outline" label="Name">
<!--labels will work only with @angular/[email protected] -->
Expand Down Expand Up @@ -176,7 +180,7 @@
</mat-form-field>

<!--password-->
<div>
<div fxLayout="column">

<mat-form-field appearance="outline">
<!--<mat-label>Password</mat-label>-->
Expand Down Expand Up @@ -210,6 +214,11 @@
[externalError]="sigUpPasswordFormControl.dirty">
</mat-password-strength>

<!--<div fxLayout="column" fxLayoutAlign="start" style="margin-top: 0.5rem">-->
<!--<mat-checkbox>I agree to the Terms of Service and Conditions</mat-checkbox>-->
<!--<mat-checkbox>I have read and agree to the Privacy Policy</mat-checkbox>-->
<!--</div>-->

</div>

<button mat-raised-button
Expand Down
5 changes: 3 additions & 2 deletions src/module/interfaces/config.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import GithubAuthProvider = firebase.auth.GithubAuthProvider;
import AuthProvider = firebase.auth.AuthProvider;

export interface NgxAuthFirebaseUIConfig {
authNextURL?: string,
authMethod?: string, // popup or redirect
authNextURL?: string, // popup or redirect
tosUrl?: string, // term of services url
ppUrl?: string, // privacy policy url
authProviders?: Array<AuthProvider>,
languageCode?: string, // todo: 28.3.18
onlyEmailPasswordAuth?: boolean,
Expand Down
4 changes: 3 additions & 1 deletion src/module/ngx-auth-firebase-u-i.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ export {UserComponent} from './components/user/user.component';
export {AuthProvidersComponent, Theme, Layout} from './components/providers/auth.providers.component';
// services
export {AuthProcessService, AuthProvider} from './services/auth-process.service';
export {NgxAuthFirebaseUIConfig} from './interfaces/config.interface';
export {FirestoreSyncService} from './services/firestore-sync.service';

// interfaces
export {NgxAuthFirebaseUIConfig} from './interfaces/config.interface';

export const NgxAuthFirebaseUIConfigToken = new InjectionToken<NgxAuthFirebaseUIConfig>('NgxAuthFirebaseUIConfig');

@NgModule({
Expand Down
8 changes: 5 additions & 3 deletions src/module/services/auth-process.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {EventEmitter, Inject, Injectable, InjectionToken} from '@angular/core';
import {MatSnackBar} from '@angular/material';
import {AngularFireAuth} from 'angularfire2/auth';
import {ISignInProcess, ISignUpProcess} from '../interfaces/main.interface';
import {NgxAuthFirebaseUIConfig} from '../interfaces/config.interface';
import {FirestoreSyncService} from './firestore-sync.service';
import * as firebase from 'firebase';
// import User = firebase.User;
Expand All @@ -12,7 +13,7 @@ import UserCredential = firebase.auth.UserCredential;
import GithubAuthProvider = firebase.auth.GithubAuthProvider;
import {Accounts} from '../enums';
import {User, UserInfo} from 'firebase';
import {NgxAuthFirebaseUIConfig, NgxAuthFirebaseUIConfigToken} from '../..';
import {NgxAuthFirebaseUIConfigToken} from '../ngx-auth-firebase-u-i.module';

export enum AuthProvider {
ALL = 'all',
Expand All @@ -34,8 +35,9 @@ export class AuthProcessService implements ISignInProcess, ISignUpProcess {
emailConfirmationSent: boolean;
emailToConfirm: string;

constructor(public auth: AngularFireAuth,
@Inject(NgxAuthFirebaseUIConfigToken) private config: NgxAuthFirebaseUIConfig,
constructor(@Inject(NgxAuthFirebaseUIConfigToken)
public config: NgxAuthFirebaseUIConfig,
public auth: AngularFireAuth,
public _snackBar: MatSnackBar,
private _fireStoreService: FirestoreSyncService) {
}
Expand Down
12 changes: 0 additions & 12 deletions src/module/services/config.service.ts

This file was deleted.

0 comments on commit 61d1efa

Please sign in to comment.