Skip to content

Commit 8af911b

Browse files
committed
update
1 parent b669c69 commit 8af911b

5 files changed

Lines changed: 54 additions & 53 deletions

File tree

codecamp-front/src/app/components/profile/profile.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ export class ProfileComponent implements OnInit {
1616
) {
1717
this.user = authService.getprofile().subscribe(profile => {
1818
this.user = profile.msg;
19-
console.log(JSON.stringify(this.user));
19+
//console.log(JSON.stringify(this.user));
2020
});
21-
console.log(this.user);
21+
//console.log(this.user);
2222
}
2323

2424
ngOnInit() {
Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,109 @@
11
<div class="container">
22
<form [formGroup]="form" (submit)="onSignupSubmit()">
3-
<div class="form-group">
3+
<div class="form-group">
44
<label for="name">Name</label>
5-
<input type="text"
6-
name="name"
7-
formControlName="name"
8-
class="form-control"
9-
placeholder="Enter Name"
5+
<input type="text"
6+
name="name"
7+
formControlName="name"
8+
class="form-control"
9+
placeholder="Enter Name"
1010
autocomplete="off"
1111
[ngClass]="{'is-invalid': (form.controls.name.errors && form.controls.name.dirty) , 'is-valid': !form.controls.name.errors}">
1212
</div>
1313

1414
<div class="form-group">
1515
<label for="username">Username</label>
1616
<input type="text"
17-
name="username"
18-
formControlName="username"
19-
class="form-control"
20-
placeholder="Enter username(XYZ)"
17+
name="username"
18+
formControlName="username"
19+
class="form-control"
20+
placeholder="Enter username(XYZ)"
2121
autocomplete="off"
2222
[ngClass]="{'is-invalid': (form.controls.username.errors && form.controls.username.dirty) , 'is-valid': !form.controls.username.errors}">
2323
</div>
2424

2525
<!-- Email Input -->
2626
<div class="form-group">
2727
<label for="email">Email</label>
28-
<input type="text"
29-
name="email_id"
30-
class="form-control"
28+
<input type="text"
29+
name="email_id"
30+
class="form-control"
3131
[ngClass]="{'is-invalid': (form.controls.email_id.errors && form.controls.email_id.dirty) , 'is-valid': !form.controls.email_id.errors}"
32-
autocomplete="off"
33-
placeholder="*email"
32+
autocomplete="off"
33+
placeholder="*email"
3434
formControlName="email_id">
3535
<!-- Validation -->
3636
<div *ngIf="form.controls.email_id.errors?.required && form.controls.email_id.dirty" class="invalid-feedback">This Field is required</div>
3737
<div class="invalid-feedback" *ngIf="(form.controls.email_id.errors?.minlength && form.controls.email_id.dirty || form.controls.email_id.errors?.maxlength && form.controls.email_id.dirty ) && form.controls.email_id.dirty">Minimum characters: 5, Maximum characters: 30</div>
3838
<div class="invalid-feedback" *ngIf="form.controls.email_id.errors?.validateemail && form.controls.email_id.dirty">This must be a valid e-mail</div>
3939
</div>
40-
40+
4141
<div class="form-group">
4242
<label for="college">College</label>
43-
<input type="text"
44-
name="college"
45-
formControlName="college"
46-
class="form-control"
47-
placeholder="Enter college name"
43+
<input type="text"
44+
name="college"
45+
formControlName="college"
46+
class="form-control"
47+
placeholder="Enter college name"
4848
autocomplete="off"
4949
[ngClass]="{'is-invalid': (form.controls.college.errors && form.controls.college.dirty) , 'is-valid': !form.controls.college.errors}">
5050
</div>
5151

5252
<div class="form-group">
5353
<label for="city">City</label>
54-
<input type="text"
55-
name="city"
56-
formControlName="city"
57-
class="form-control" placeholder="Enter city" autocomplete="off">
54+
<input type="text"
55+
name="city"
56+
formControlName="city"
57+
class="form-control" placeholder="Enter city" autocomplete="off">
5858
</div>
59-
59+
6060
<div class="form-group">
6161
<label for="dob">Date Of Birth</label>
6262
<input type="date"
63-
name="dob"
64-
formControlName="dob"
65-
class="form-control"
63+
name="dob"
64+
formControlName="dob"
65+
class="form-control"
6666
autocomplete="off"
6767
[ngClass]="{'is-invalid': (form.controls.dob.errors && form.controls.dob.dirty) , 'is-valid': !form.controls.dob.errors}">
6868
</div>
6969

7070
<div class="form-group">
7171
<label for="gender">Gender</label>
72-
<input type="text"
73-
name="gender"
74-
formControlName="gender"
75-
class="form-control"
76-
placeholder="Male/Female"
72+
<input type="text"
73+
name="gender"
74+
formControlName="gender"
75+
class="form-control"
76+
placeholder="Male/Female"
7777
autocomplete="off">
7878
</div>
7979

8080
<div class="form-group">
8181
<label for="password">Password</label>
82-
<input type="password"
83-
name="password"
84-
formControlName="password"
85-
class="form-control"
86-
placeholder="Enter password"
82+
<input type="password"
83+
name="password"
84+
formControlName="password"
85+
class="form-control"
86+
placeholder="Enter password"
8787
autocomplete="off"
8888
[ngClass]="{'is-invalid': (form.controls.password.errors && form.controls.password.dirty) , 'is-valid': !form.controls.password.errors}">
8989
</div>
9090

9191
<div class="form-group">
9292
<label for="confirmpassword">Confirm Password</label>
93-
<input type="password"
94-
name="confirm"
95-
formControlName="confirm"
96-
class="form-control"
97-
placeholder="Confrim password"
93+
<input type="password"
94+
name="confirm"
95+
formControlName="confirm"
96+
class="form-control"
97+
placeholder="Confrim password"
9898
autocomplete="off"
9999
[ngClass]="{'is-invalid': (form.controls.confirm.errors && form.controls.confirm.dirty) || (form.errors?.matchingPasswords && form.controls.confirm.dirty) , 'is-valid': !form.controls.confirm.errors && !form.errors?.matchingPasswords}">
100100
<div *ngIf="form.errors?.matchingPasswords && form.controls.confirm.dirty"
101101
class="invalid-feedback">Password do not match</div>
102-
102+
103103
</div>
104104

105-
<input
105+
<input
106106
[disabled]="!form.valid|| processing "
107107
type="submit" class="btn btn-primary" value="Sign up">
108108
</form>
109-
</div>
109+
</div>

codecamp-front/src/app/components/register/register.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class RegisterComponent implements OnInit {
4141
username: ['', Validators.required],
4242
confirm: ['', Validators.required],
4343
college: ['', Validators.required],
44-
gender: '',
44+
gender: ['', Validators.required],
4545
dob: ['', Validators.required],
4646
city: ['', Validators.required]
4747
}, { validator: this.matchingPasswords('password', 'confirm')});
@@ -80,7 +80,8 @@ export class RegisterComponent implements OnInit {
8080
password: this.form.get('password').value,
8181
dob: this.form.get('dob').value,
8282
city: this.form.get('city').value,
83-
gender: this.form.get('gender').value
83+
gender: this.form.get('gender').value,
84+
joinedOn: Date.now()
8485
};
8586
this.authService.registerUser(user).subscribe(data => {
8687
if (!data.success) {

codecamp-front/src/app/services/auth.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class AuthService {
3030

3131
loadToken() {
3232
this.authToken = localStorage.getItem('token');
33-
console.log(this.authToken); // Get token and asssign to variable to be used elsewhere
33+
//console.log(this.authToken); // Get token and asssign to variable to be used elsewhere
3434
}
3535
registerUser(user) {
3636
return this.http.post(this.domain + '/users/signup', user)

server/models/user/user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ UserSchema.pre('save',function(next) {
1717
UserSchema.methods.toJSON = function() {
1818
var user = this ;
1919
var userObject = user.toObject();
20-
return _.pick(userObject,['email_id','_id','college','name','bio','joinedOn','username','city','gender'])
20+
return _.pick(userObject,['email_id','_id','college','name','dob','bio','joinedOn','username','city','gender'])
2121
}
2222

2323
UserSchema.statics.findByUsername=function(username,password,done){

0 commit comments

Comments
 (0)