Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions bookswap/bookswap_client/src/components/Home/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class Profile extends Component {
userAboutMe:this.state.userAboutMe||this.state.user_profile.aboutMe,
userContactNumber:this.state.userContactNumber||this.state.user_profile.contactNumber,
userCity:this.state.userCity||this.state.user_profile.city,
userState:this.state.userState||this.state.user_profile.state,
userStateName:this.state.userState||this.state.user_profile.stateName,
userZipcode:this.state.userZipcode||this.state.user_profile.zipcode,
userCountry:this.state.userCountry||this.state.user_profile.country

}
Expand Down Expand Up @@ -149,9 +150,15 @@ class Profile extends Component {
userCity: e.target.value
});
};
stateChange = (e) => {

zipcodeChange = (e) => {
this.setState({
userZipcode: e.target.value
});
};
stateNameChange = (e) => {
this.setState({
userState: e.target.value
userStateName: e.target.value
});
};
countryChange = (e) => {
Expand Down Expand Up @@ -248,7 +255,8 @@ await this.getSwapBook();
<div class="panel-body">{this.state.user_profile.aboutme}</div>
<div class="panel-body">{this.state.user_profile.contactNumber}</div>
<div class="panel-body">{this.state.user_profile.city}</div>
<div class="panel-body">{this.state.user_profile.state}</div>
<div class="panel-body">{this.state.user_profile.stateName}</div>
<div class="panel-body">{this.state.user_profile.zipcode}</div>
<div class="panel-body">{this.state.user_profile.country}</div>

</div>
Expand Down Expand Up @@ -329,8 +337,16 @@ await this.getSwapBook();
<div className="input-group-prepend">
<span className="input-group-text" id="basic-addon1"><b>State</b></span>
</div>
<input type="text"size="50" name="state" className="form-control" aria-label="State" aria-describedby="basic-addon1" onChange={this.stateChange} defaultValue={this.state.user_profile.state} pattern=".*\S.*" />
<input type="text"size="50" name="stateName" className="form-control" aria-label="State" aria-describedby="basic-addon1" onChange={this.stateNameChange} defaultValue={this.state.user_profile.stateName} pattern=".*\S.*" />
</div>

<div className="input-group mb-2">
<div className="input-group-prepend">
<span className="input-group-text" id="basic-addon1"><b>ZipCode</b></span>
</div>
<input type="text"size="50" name="zipcode" className="form-control" aria-label="zipcode" aria-describedby="basic-addon1" onChange={this.zipcodeChange} defaultValue={this.state.user_profile.zipcode} pattern=".*\S.*" />
</div>

<div className="input-group mb-2">
<div className="input-group-prepend">
<span className="input-group-text" id="basic-addon1"><b>Country</b></span>
Expand Down
53 changes: 52 additions & 1 deletion bookswap/bookswap_client/src/components/Login/Signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class Signup extends Component{
userEmail : "",
password : "",
name :"",
address:"",
city:"",
stateName:"",
zipcode:"",
errorMessage : "",
successFlag :false
}
Expand All @@ -40,7 +44,34 @@ class Signup extends Component{
name : e.target.value
})
}


//name change handler to update state variable with the text entered by the user
addressChangeHandler = (e) => {
this.setState({
address : e.target.value
})
}

//name change handler to update state variable with the text entered by the user
zipcodeChangeHandler = (e) => {
this.setState({
zipcode : e.target.value
})
}

//name change handler to update state variable with the text entered by the user
stateNameChangeHandler = (e) => {
this.setState({
stateName : e.target.value
})
}

//name change handler to update state variable with the text entered by the user
cityChangeHandler = (e) => {
this.setState({
city : e.target.value
})
}


//submit Login handler to send a request to the node backend
Expand All @@ -52,6 +83,10 @@ class Signup extends Component{
userEmail : this.state.userEmail,
password : this.state.password,
name : this.state.name,
address: this.state.address,
city: this.state.city,
stateName: this.state.stateName,
zipcode: this.state.zipcode
}
console.log(data);
//set the with credentials to true
Expand Down Expand Up @@ -112,6 +147,22 @@ class Signup extends Component{
<label htmlFor="password"> Create Password:</label>
<input onChange = {this.passwordChangeHandler} type="password" className="form-control" name="password" placeholder="Password" required />
</div>
<div className="form-group">
<label htmlFor="address"> Enter address:</label>
<input onChange = {this.addressChangeHandler} type="text" className="form-control" name="Address" placeholder="Address" required />
</div>
<div className="form-group">
<label htmlFor="city"> Enter City:</label>
<input onChange = {this.cityChangeHandler} type="text" className="form-control" name="city" placeholder="City" required />
</div>
<div className="form-group">
<label htmlFor="stateName"> State:</label>
<input onChange = {this.stateNameChangeHandler} type="text" className="form-control" name="stateName" placeholder="CA" required />
</div>
<div className="form-group">
<label htmlFor="zipcode"> Enter Zipcode:</label>
<input onChange = {this.zipcodeChangeHandler} type="text" className="form-control" name="zipcode" placeholder="ZipCode" required />
</div>
<button type ="submit" className="btn btn-primary">Sign Up</button>
</form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion bookswap/bookswap_ml/jupyter_notebook/Process_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.6"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion bookswap/bookswap_ml/jupyter_notebook/data_clean.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.6"
}
},
"nbformat": 4,
Expand Down
9 changes: 6 additions & 3 deletions bookswap/bookswap_server/models/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ var usersSchema = new Schema({
name: {type: String, required: true},
password: {type: String, required: true},
emailId:{type:String,required:true},
address:{type:String,required:true},
city:{type:String,required:true},
stateName:{type:String,required:true},
zipcode:{type:String,required:true},
country:{type:String,required:false},
aboutme:{type:String,required:false},
contactNumber:{type:String,required:false},
city:{type:String,required:false},
state:{type:String,required:false},
country:{type:String,required:false},

image:{type:String,required:false},

},
Expand Down
6 changes: 4 additions & 2 deletions bookswap/bookswap_server/routes/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Users.findOne({ _id: req.body.userId}, (err, user) => {
aboutme:user.aboutme,
contactNumber:user.contactNumber,
city:user.city,
state:user.state,
stateName:user.stateName,
zipcode:user.zipcode,
country:user.country,
image:user.image,

Expand Down Expand Up @@ -56,7 +57,8 @@ Users.findOne({ _id: req.body.userId}, (err, user) => {
aboutme:req.body.userAboutMe,
contactNumber:req.body.userContactNumber,
city:req.body.userCity,
state:req.body.userState,
stateName:req.body.userStateName,
zipcode:req.body.userZipcode,
country:req.body.userCountry
},
{
Expand Down
5 changes: 5 additions & 0 deletions bookswap/bookswap_server/routes/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ var newUser = new Users({
emailId: req.body.userEmail,
password: req.body.password,
name: req.body.name,
address: req.body.address,
city: req.body.city,
stateName:req.body.stateName,
zipcode: req.body.zipcode

});
console.log(newUser)
Users.findOne({ emailId: req.body.userEmail}, (err, user) => {
if (err) {
res.status(500).end("System Error");
Expand Down
3 changes: 3 additions & 0 deletions bookswap/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.