<script src="https://www.gstatic.com/firebasejs/8.4.1/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/8.4.1/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.4.1/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.4.1/firebase-database.js"></script>
<scipt>
const firebaseConfig = {
apiKey: "APIKEY",
authDomain: "my-project-ID.firebaseapp.com",
projectId: "my-project-ID",
storageBucket: "my-project-ID.appspot.com",
messagingSenderId: "messagingSenderID",
appId: "1:APIID",
measurementId: "MEASUREMENT-ID",
databaseURL: "https://my-project-ID-default-rtdb.firebaseio.com/",
};
</scipt>
<script>
var New_Password = "test123";
const user = firebase.auth().currentUser;
user.updatePassword(New_Password).then(() => {
alert("successfully updated password");
}).catch(function (error) {
alert("failed"+ error.message);
});
/********** UPDATE USER DATA ***********/
$("#updateUserData").on('click', function (e) {
e.preventDefault();
var firstName = $("#First-Name-Account").val();
var lastName = $("#Last-Name-Account").val();
var emailAddress = $("#Email-Account").val();
var phoneNumber = $("#Phone-Account").val();
let userRef = database.ref('users/' + userId);
userRef.child(userId).set({
"firstName": firstName,
'lastName': lastName,
'emailAddress': emailAddress,
'phoneNumber': phoneNumber
}).then(function() {
errors = "Profile updated successfully";
alert(errors);
// Data saved successfully!
})
.catch(function(error) {
// The write failed...
errors = error.message;
alert(errors);
});
});
</script>
I’m an experienced, dedicated and ambitious Programmer looking for a challenging career as a Web Developer with the opportunity to work with the latest technologies on challenging and diverse projects.
Friday, November 5, 2021
Update User password in firebase and update data in firebase table
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment