本文整理匯總了TypeScript中firebase/app.auth函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript auth函數的具體用法?TypeScript auth怎麽用?TypeScript auth使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了auth函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Promise
return new Promise((resolve, reject) => {
firebase.auth().sendPasswordResetEmail(email).then((data) => {
resolve(data);
}, (error) => {
reject(error);
});
});
示例2: constructor
constructor(model: BagitModelService)
{
this._curFirebaseUser = undefined;
this._currentUser$ = new BehaviorSubject<User | null>(null);
this._model = model;
//
// Setup to handle authentication state changes.
//
this._authInitializedPromise = new Promise((resolve) => {
// Hang on to the resolve function so that we can call it once the
// initial auth state change happens.
this._resolveAuthInitializedPromise = resolve;
});
this._firebaseAuth = auth();
this._firebaseAuth.onAuthStateChanged(this.onAuthStateChanged.bind(this));
this._isConnected$ = new BehaviorSubject<boolean>(false);
const connectedRef = database().ref(".info/connected");
connectedRef.on("value", (snap: database.DataSnapshot | null) => {
if (snap) {
this._isConnected$.next(snap.val());
}
});
}
示例3: resolve
}).then((response) => {
const googleCredential = firebase.auth.GoogleAuthProvider.credential(response.idToken);
firebase.auth().signInWithCredential(googleCredential)
.then((user) => {
resolve();
});
},(err) => {
示例4: registerAccount
async registerAccount(username: string, password: string) {
await firebase.auth().createUserWithEmailAndPassword(username, password);
setImmediate(async () => {
await MessageBox.show(`Thank you for signing up ${username}. Please login now.`, "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Information);
let dialog = new LoginDialog(this.login.bind(this), this.resetPassword.bind(this), this.signup.bind(this));
dialog.open();
});
}
示例5: Promise
return new Promise((resolve, reject) => {
if(firebase.auth().currentUser){
this.afAuth.auth.signOut();
resolve();
}
else{
reject();
}
});
示例6: resolve
return new Promise<any>((resolve, reject) => {
var user = firebase.auth().currentUser;
user.updateProfile({
displayName: value.name,
photoURL: user.photoURL
}).then(res => {
resolve(res);
}, err => reject(err))
})
示例7: sendResetEmail
async sendResetEmail(username: string) {
firebase.auth().sendPasswordResetEmail(username, {
url: `${location.origin}?email=${encodeURIComponent(username)}`
});
Spinner.hide();
await MessageBox.show("The password reset has been sent. Check your inbox for instructions.", "Reset Email Sent", MessageBoxButtons.OK, MessageBoxIcon.Information);
let loginDialog = new LoginDialog(this.login.bind(this), this.resetPassword.bind(this), this.signup.bind(this));
loginDialog.open();
}