Я пытаюсь создать страницу регистрации для новых пользователей. Предполагается, что данные будут отправлены прямо в базу данных Firebase сразу после регистрации. Проблема в том, что firebase постоянно выдает ошибку «пароль должен быть больше 6 символов». Я не знаю почему, потому что я вставил более чем достаточно букв.
Большое спасибо
import React, { Component } from 'react';
import ReactDOM from 'react-dom'
import NavbarT from './UnivComp/navbar.js';
import FooterT from './UnivComp/footer.js';
import fire from './config/firebased.js';
import writeUserData from './config/rwfire.js'
import firebase from 'firebase';
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
class Apppr extends Component {
constructor(props) {
super(props);
this.signup = this.signup.bind(this);
this.state = {
email: '',
password: '',
subject:'',
location:'',
telephone:'',
brief:'',
youtubevid:'',
};
}
signup(e){
e.preventDefault();
console.log(e);
firebase.auth().createUserWithEmailAndPassword("galbeedmok@gmail.com","gem")
.then((res) => {
firebase.database().ref('users/' + res.user.uid).set({
email: this.state.email,
password: this.state.password,
subject: this.state.subject,
location: this.state.location,
telephone: this.state.telephone,
brief: this.state.brief,
youtubevid: this.state.youtubevid,
});
});
}
render() {
const { signup } = this.props;
return (
<div>
<NavbarT/>
<form class = " clearin container mx-auto">
<div class="form-group pb-3">
<label for="exampleInputEmail1"><h3>Email address</h3></label>
<input type="email" class="form-control input-md" id="exampleInputEmail1" value={this.state.email} onChange={e => this.setState({ email: e.target.value })} aria-describedby="emailHelp" placeholder="Enter email"/>
<small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<div class="form-group pb-3">
<label for="exampleInputPassword1"><h3>Password</h3></label>
<input type="password" class="form-control input-md" id="exampleInputPassword1" value={this.state.password} onChange={e => this.setState({ password: e.target.value })} placeholder="Password"/>
{console.log(this.state.password)}
</div>
<div class="form-group">
<label for="exampleFormControlSelect2 "><h3>What subjects do you tutor?</h3></label>
<select multiple class="form-control form-control-lg" value={this.state.subject} onChange={e => this.setState({ subject : "Physics" })} id="exampleFormControlSelect2">
<option>Physics</option>
<option>Chemistry</option>
<option>Human Biology</option>
<option>Mathematics</option>
<option>ESL</option>
<option>English</option>
</select>
</div>
<div class="mb-5 form-group pb-3 ">
<label><h3>Where abouts are you located?</h3></label>
<input class="form-control input-md" value={this.state.location} onChange={e => this.setState({ location: e.target.value })} aria-describedby="emailHelp" placeholder="e.g Claremont"/>
</div>
<div class="form-group pb-3 ">
<label for="example-tel-input">Telephone</label>
<input class="form-control input-md" type="tel" placeholder="1-(555)-555-5555" id="example-tel-input" value={this.state.telephone} onChange={e => this.setState({ telephone: e.target.value })}/>
</div>
<div class="form-group pb-3">
<label for="exampleTextarea"><h3>Give students a brief description of yourself.</h3></label>
<textarea class="form-control input-md" id="exampleTextarea" rows="3" value={this.state.brief} onChange={e => this.setState({ brief: e.target.value })}></textarea>
</div>
<div class="form-group pb-3">
<label for="exampleInputEmail1"><h3>A youtube video depicting your work</h3></label>
<input class="form-control input-md" aria-describedby="emailHelp" placeholder="https://www.youtube.com/watch?v=ZlRObEeuuJM" value={this.state.youtubevid} onChange={e => this.setState({ youtubevid: e.target.value })}/>
</div>
<br/>
<button onClick={console.log(this.state.password)} style={{marginLeft: '25px'}} class="btn btn-success">Signup</button>
</form>
<FooterT/>
</div>
);
}
}
export default Apppr;