项目作者: firebaseui

项目描述 :
Angular Bootstrap UI library for firebase authentication powered by @ng-bootstrap and @angularfire2
高级语言: TypeScript
项目地址: git://github.com/firebaseui/ng-bootstrap.git
创建时间: 2018-06-28T20:09:54Z
项目社区:https://github.com/firebaseui/ng-bootstrap

开源协议:MIT License

下载




@firebaseui/ng-bootstrap - Angular Bootstrap UI library for firebase authentication powered by @ng-bootstrap

npm version
npm demo
Join the chat at https://gitter.im/firebaseui/Lobby
CircleCI branch
Build Status
Coverage Status
dependency Status
devDependency Status
Greenkeeper Badge
license

firebaseui/ng-bootstrap - sign in, sign up demo image
firebaseui/ng-bootstrap - reset password demo image

Built by and for developers :heart:

Do you have any question or suggestion ? Please do not hesitate to contact us!
Alternatively, provide a PR | open an appropriate issue here

If did you like this project, support @firebaseui/ng-bootstrap
by starring :star: and sharing it :loudspeaker:

If you prefer to develop with material design rather than with bootstrap, please check this project ngx-auth-firebaseui

Table of Contents

ngx-auth-firebaseui vs firebaseui-web

Features @firebaseui/ng-bootstrap ngx-auth-firebaseui firebaseui
Sign Up :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Sign In :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Sign In Anonymously :heavy_check_mark: :heavy_check_mark: :x:
Sign In with Google :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Sign In with Facebook :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Sign In with Twitter :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Sign In with Github :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Sign In with PhoneNumber :soon: :x: :heavy_check_mark:
Sign out :heavy_check_mark: :heavy_check_mark: :x:
Sign in/up progress indicator :heavy_check_mark: :heavy_check_mark: :x:
Password Strength indicator :soon: :heavy_check_mark: :x:
Forgot/Reset Password :heavy_check_mark: :heavy_check_mark: :x:
Delete account :soon: :heavy_check_mark: :x:
User Profile :soon: :heavy_check_mark: :x:
Check whether user’s email is verified :soon: :heavy_check_mark: :x:
Edit user’s display name (incl. validation) :soon: :heavy_check_mark: :x:
Edit user’s email (incl. validation) :soon: :heavy_check_mark: :x:
Edit user’s phone number (incl. validation) :soon: :heavy_check_mark: :x:
Configure your favorite auth provider in runtime :heavy_check_mark: :heavy_check_mark: :x:
Sync user’auth with Firestore read more :heavy_check_mark: :heavy_check_mark: :x:
Angular v2-6 friendly :heavy_check_mark: :heavy_check_mark: :x:
Internationalization (i18n) :soon: @angular v7 :soon: @angular v7 :heavy_check_mark:
Ionic/cordova support :soon: @firebaseui/ionic-auth :soon: @firebaseui/ionic-auth :x:
Real time form validation :heavy_check_mark: :heavy_check_mark: :x:
Easy to integrate :heavy_check_mark: :heavy_check_mark: :x:
Support Server Side Rendering :heavy_check_mark: :heavy_check_mark: :x:
Support SPA without further config :heavy_check_mark: :heavy_check_mark: :x:
Support Safari private browsing :heavy_check_mark: :heavy_check_mark: :x:
AWESOME :soon: :heavy_check_mark: :interrobang:

@firebaseui/ng-bootstrap">

Why to use @firebaseui/ng-boostrap ?

  • :gift_heart: it uses a responsive and accessible web design UX/UI from twitter bootstrap concepts and components (supporting desktop and mobile view).
  • :lipstick: pick up your own theme! change the primary, secondary and danger colors whenever you need (e.g to support light and dark themes) via scss - bootstrap
  • :ship: super easy to use with an angular based project (project that is created with the angular-cli)
  • :soon: optional configuration
  • :soon: configure your authentication providers in runtime
  • :recycle: reusable components for every project that needs an authentication with a firebase project/app.
  • :soon: built in feedback mechanism in form of a alert when an error or any important event occurred.
  • :soon: ability to sign out or even to delete totally the account
  • :ghost: your client does not want to create an account in your project? Let him to sign in anonymously!
  • :soon: user profile component to display user’s data using via ngb-auth-firebaseui-user
  • :zap: update user profile as feature
  • :fire: Sync user’s authentication with FIRESTORE AUTOMATICALLY
  • :muscle: Forgot Password feature! Go and let your users to recover their passwords easily
  • :tada: Supports SSR - Server Side Rendering

Library’s components

  • <ngb-auth-firebaseui> used for the authentication process
  • :soon: <ngb-auth-firebaseui-providers> used to display only buttons for providers like googe, facebook, twitter and github
  • :soon: <ngb-auth-firebaseui-user> used to display/edit the data of the current authenticated user

Supported Providers:

  • anonymously
  • email and password (traditional)
  • google
  • facebook
  • twitter
  • github
  • phone number :soon:

Supported Processes and Actions:

  • sign up
  • sign in
  • sign in Anonymously | with google, facebook, twitter, github
  • sign out
  • validation of password’s strength while creating a new account using ngb-material-password-strength :soon:
  • forgot/reset password :soon:
  • sending email verifications
  • delete user’s account :soon:
  • edit user’s profile like email, name, (profile picture :soon:) and phone number :soon:
  • firestore auto sync :fire:

Demo

  • Try it out
    1. if(issues || feedback || you_need_more_features){
    2. // send me an email -> to: anthony.na@hotmail.de
    3. }

Dependencies

Requirements:

  1. npm install --save @ng-bootstrap/ng-bootstrap bootstrap @angular/fire firebase font-awesome @angular/forms @angular/animations

Installation

Install above dependencies via npm.

Now install @firebaseui/ng-bootstrap via:

  1. npm install --save @firebaseui/ng-bootstrap

SystemJS

Note:If you are using SystemJS, you should adjust your configuration to point to the UMD bundle.
In your systemjs config file, map needs to tell the System loader where to look for @firebaseui/ng-bootstrap:

  1. map: {
  2. '@firebaseui/ng-bootstrap': 'node_modules/@firebaseui/ng-bootstrap/bundles/@firebaseui/ng-bootstrap.umd.js',
  3. }

Once installed you need to import the main module:

  1. import { NgbAuthFirebaseUIModule } from '@firebaseui/ng-bootstrap';

The only remaining part is to list the imported module in your application module. The exact method will be slightly
different for the root (top-level) module for which you should end up with the code similar to (notice NgbAuthFirebaseUIModule.forRoot()):

  1. import { NgbAuthFirebaseUIModule } from '@firebaseui/ng-bootstrap';
  2. @NgModule({
  3. declarations: [AppComponent, ...],
  4. imports: [NgbAuthFirebaseUIModule.forRoot({
  5. apiKey: 'your-firebase-apiKey',
  6. authDomain: 'your-firebase-authDomain',
  7. databaseURL: 'your-firebase-databaseURL',
  8. projectId: 'your-firebase-projectId',
  9. storageBucket: 'your-firebase-storageBucket',
  10. messagingSenderId: 'your-firebase-messagingSenderId'
  11. }), ...],
  12. bootstrap: [AppComponent]
  13. })
  14. export class AppModule {
  15. }

Other modules in your application can simply import NgbAuthFirebaseUIModule:

  1. import { NgbAuthFirebaseUIModule } from '@firebaseui/ng-bootstrap';
  2. @NgModule({
  3. declarations: [OtherComponent, ...],
  4. imports: [NgbAuthFirebaseUIModule, ...],
  5. })
  6. export class OtherModule {
  7. }

Usage

<ngb-auth-firebaseui></ngb-auth-firebaseui>

  1. <!-- You can now use the library component in app.component.html -->
  2. <ngb-auth-firebaseui (onSuccess)="printUser($event)"
  3. (onError)="printError()">
  4. </ngb-auth-firebaseui>

or

  1. <!-- or simply in the app.component.ts -->
  2. @Component({
  3. selector: 'app',
  4. template: `
  5. <ngb-auth-firebaseui (onSuccess)="printUser($event)" (onError)="printError()"></ngb-auth-firebaseui>`
  6. })
  7. class AppComponent {
  8. printUser(event) {
  9. console.log(event);
  10. }
  11. printError(event) {
  12. console.error(event);
  13. }
  14. }

<ngb-auth-firebaseui-providers></ngb-auth-firebaseui-providers>

  1. <!-- You can now use the library component in app.component.html -->
  2. <ngb-auth-firebaseui-providers layout="column"></ngb-auth-firebaseui-providers>

API

<ngb-auth-firebaseui></ngb-auth-firebaseui>

option bind type default description
guestEnabled Input() boolean true whether the user can sign in and continue as guest
providers Input() string[] [‘all’] or [AuthProvider.All] choose your favorite authentication provider: google facebook twitter github
onSuccess Output() any - this will be fired when an authentication process was success. The authenticated user is emitted!
onError Output() any - this event will be fired when an error occurred during the authentication process! An error message is emitted!

How to disable users to sign in and continue as guest, use the guestEnabled input

  1. <ngb-auth-firebaseui [guestEnabled]="false"
  2. (onSuccess)="printUser($event)"
  3. (onError)="printError($event)">
  4. </ngb-auth-firebaseui>

How to configure your input providers ? see the examples

e.g:
in your component, import the AuthProvider enum to pick up your favorite provider:

  1. import {OnInit} from '@angular/core';
  2. import {AuthProvider} from '@firebaseui/ng-bootstrap';
  3. export class ExampleComponent implements OnInit {
  4. providers = AuthProvider;
  5. ngOnInit() {
  6. }
  7. }

in your template —>

  1. <ngb-auth-firebaseui
  2. [providers]="[providers.Google, providers.Facebook, providers.Twitter]"
  3. (onSuccess)="printUser($event)"
  4. (onError)="printError()"></ngb-auth-firebaseui>

or

  1. <ngb-auth-firebaseui
  2. [providers]="['google', 'facebook', 'twitter']"
  3. (onSuccess)="printUser($event)"
  4. (onError)="printError()">
  5. </ngb-auth-firebaseui>

Run Demo App Locally

  • clone this repo by running
    1. $ git clone https://github.com/firebaseui/ng-bootstrap.git
  • link the ngb-auth-firebaseui package
    use gulp globally
    1. $ gulp link
  • navigate to the demo app directory

    1. $ cd demo
  • install the dependencies

    1. $ npm i
  • run/start/serve the app
    1. $ npm run start
    or
    1. $ ng serve --open
  • the app is now hosted by http://localhost:4200/

Development

To generate all *.js, *.d.ts and *.metadata.json files:

  1. $ npm run build

Other Angular Libraries


Support

  • Drop an email to: Anthony Nahas
  • or open an appropriate issue
  • let us chat on Gitter

    Built by and for developers :heart: we will help you :punch:


jetbrains logo

This project is supported by jetbrains with 1 ALL PRODUCTS PACK OS LICENSE incl. webstorm


License

Copyright (c) 2018 Anthony Nahas. Licensed under the MIT License (MIT)