mirror of
https://github.com/Nezumi-2711/foodify-frontend.git
synced 2026-09-22 13:38:44 +00:00
Deployment 29.4 v1.0
This commit is contained in:
Generated
+207
-158
File diff suppressed because it is too large
Load Diff
@@ -116,8 +116,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- phone number -->
|
||||
<div class="form-group row">
|
||||
<!--capcha -->
|
||||
<div *ngIf="isSend" class="form-group row">
|
||||
<div class="col-xl-3 col-md-4">
|
||||
<label for="validationCustom2"><span></span></label>
|
||||
</div>
|
||||
@@ -430,3 +430,10 @@
|
||||
<button type="button" class="btn btn-primary" (click)="closeLayer2()">Tiếp tục</button>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #empty_phonenumber>
|
||||
<div class="modal-body text-center">
|
||||
<h5>Số điện thoại không được bỏ trống.</h5>
|
||||
<button type="button" class="btn btn-primary" (click)="closeLayer2()">Tiếp tục</button>
|
||||
</div>
|
||||
</ng-template>
|
||||
@@ -69,8 +69,10 @@ export class SignupComponent {
|
||||
@ViewChild('error_modal') errorModal: TemplateRef<any>;
|
||||
@ViewChild('miss_info') missInfoModal: TemplateRef<any>;
|
||||
@ViewChild('miss_otp') missOTPModal: TemplateRef<any>;
|
||||
@ViewChild('empty_phonenumber') emptyPhoneNumber: TemplateRef<any>;
|
||||
|
||||
//Phonenumber
|
||||
isSend: boolean = false;
|
||||
isVerified: boolean = false;
|
||||
reCaptchaVerifier;
|
||||
verify;
|
||||
@@ -78,10 +80,8 @@ export class SignupComponent {
|
||||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
private authService: AuthService,
|
||||
private firebaseAuth: AngularFireAuth,
|
||||
private districtService: DistrictService,
|
||||
private storage: AngularFireStorage,
|
||||
private shopService: ShopService,
|
||||
private modalService: BsModalService,
|
||||
private router: Router,
|
||||
private firebaseService: FirebaseService
|
||||
@@ -338,31 +338,43 @@ export class SignupComponent {
|
||||
}
|
||||
|
||||
getOTP() {
|
||||
this.reCaptchaVerifier = new firebase.auth.RecaptchaVerifier(
|
||||
'recapcha',
|
||||
{
|
||||
size: 'visible',
|
||||
}
|
||||
);
|
||||
const reg: User = new User();
|
||||
reg.phoneNumber = this.userPhoneNumber.value;
|
||||
|
||||
firebase
|
||||
.auth()
|
||||
.signInWithPhoneNumber('+84 ' + this.userPhoneNumber.value, this.reCaptchaVerifier)
|
||||
.then((confirmationResult) => {
|
||||
if (this.userPhoneNumber.value == '') {
|
||||
this.layer2 = this.modalService.show(this.emptyPhoneNumber, { class: 'modal-sm' });
|
||||
}
|
||||
else {
|
||||
this.authService.checkEmailOrPhoneNumberExist(reg).subscribe((response) => {
|
||||
if (response.title == 'phoneNumExist') {
|
||||
this.errorItem = "Số điện thoại"
|
||||
this.layer2 = this.modalService.show(this.errorModal, { class: 'modal-sm' });
|
||||
}
|
||||
else {
|
||||
this.isSend = true;
|
||||
this.reCaptchaVerifier = new firebase.auth.RecaptchaVerifier(
|
||||
'recapcha',
|
||||
{
|
||||
size: 'visible',
|
||||
}
|
||||
);
|
||||
|
||||
this.verify = confirmationResult.verificationId;
|
||||
|
||||
console.log("send code!");
|
||||
firebase
|
||||
.auth()
|
||||
.signInWithPhoneNumber('+84 ' + this.userPhoneNumber.value, this.reCaptchaVerifier)
|
||||
.then((confirmationResult) => {
|
||||
this.verify = confirmationResult.verificationId;
|
||||
})
|
||||
.catch((error) => {
|
||||
//Catch error
|
||||
alert(error.message);
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
//Catch error
|
||||
|
||||
console.log(error.message);
|
||||
alert(error.message);
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//Districts and Wards
|
||||
|
||||
Reference in New Issue
Block a user