TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed elbarbary
NA
1.6k
275.5k
How validate old password with current password exist on db
Jan 10 2020 9:12 AM
problem
How validate old password with current password exist on db ?
I have user on database his name
michel
and password 1234567
I need when write old password on angular 7
check password exist on database for user michel as 1234567
with
password he write
if two is same not problem
but if he write password different for this
display error message
<div
class
=
"form-group"
>
<label >OldPassword</label><br>
<input type=
"password"
formControlName=
"oldPassword"
class
=
"textboxclass"
[ngClass]=
"{ 'is-invalid': submitted && c.oldPassword.errors }"
/>
<div *ngIf=
"submitted && c.oldPassword.errors"
class
=
"invalid-feedback"
>
<div *ngIf=
"c.oldPassword.errors.required"
>Password is required</div>
<div *ngIf=
"c.oldPassword.errors.minlength"
>Password must be at least 6 characters</div>
</div>
</div>
on ts
oldPassword =
new
FormControl(
''
, [Validators.required, Validators.minLength(6), Validators.maxLength(10)]);
ngOnInit() {
this
.createFormResetPassword();
}
createFormResetPassword() {
this
.ChangePasswordForm =
this
.formBuilder.group({
oldPassword:
this
.oldPassword,
}
}
onSubmit() {
this
.submitted =
true
;
if
(
this
.ChangePasswordForm.invalid) {
console.log(
"status failed "
);
return
;
}
this
.loading =
true
;
this
.userservice.changePassword()
.pipe(first())
.subscribe(
data => {
});
console.log(
"data values"
+ data);
this
.toastr.success(
'Users Added Successfully'
);
},
error => {
this
.error = error;
this
.loading =
false
;
});
}
Reply
Answers (
4
)
How to add multilocations on google map using angular 7 ?
error validations reactive form not display on my PC only ?