0

I'm trying to encrypt my password when I register on my website web in HTML, and I don't know where should I do it, here's my register code:

var username = this.usernameR;
        var password = this.passwordR;
        var email = this.emailR;
        this.$f7.dialog.alert('DENTRO');
        this.$f7.dialog.alert('Username: ' + this.usernameR + '<br>Password: ' + this.passwordR + '<br>Email: ' + this.emailR, () => {
            //this.$f7.dialog.alert('Checking password and user: ');

            
            //this.$f7.dialog.alert('database: ');
            // Obter os dados online da Firebase
                var firebaseConfig = {
                    apiKey: 
                    authDomain: 
                    databaseURL: 
                    projectId:
                    storageBucket: 
                    messagingSenderId: 
                    appId: 
                };
        
            // Initialize Firebase
            if (!firebase.apps.length) { 
                firebase.initializeApp(firebaseConfig);
            }
            // Get a reference to the database service
            var database = firebase.database();
            var ref = database.ref("/users");
            var postsRef = ref.child(username);
            
            ref.child(username).set({
                pass: password,
                Email: email
            
            });
            
            var usersRef = ref.child("/users");
            
            console.log( '/users/');
            var dialog = this.$f7.dialog;
            
    });
        
 },
bad_coder
  • 11,289
  • 20
  • 44
  • 72
  • 1
    You shouldn't store password in the database at all. It's better to sign in users with Firebase Authentication, and let it manage credentials. – Doug Stevenson Jul 10 '20 at 15:45
  • check this question and answer https://stackoverflow.com/questions/38304258/how-to-encrypt-user-data-in-firebase – IBRAHIM EZZAT Jul 10 '20 at 15:53

1 Answers1

0

I agree with Doug, storing password information in a database is not good. I would recommend checking out Auth0 to manage this type of data. https://auth0.com/