Deployment 29.4 v1.0

This commit is contained in:
Nguyen Ha Khue
2023-04-29 18:48:52 +07:00
parent 357ee61b54
commit 95a9d0cd9b
3 changed files with 252 additions and 184 deletions
+207 -158
View File
File diff suppressed because it is too large Load Diff
@@ -116,8 +116,8 @@
</div> </div>
</div> </div>
<!-- phone number --> <!--capcha -->
<div class="form-group row"> <div *ngIf="isSend" class="form-group row">
<div class="col-xl-3 col-md-4"> <div class="col-xl-3 col-md-4">
<label for="validationCustom2"><span></span></label> <label for="validationCustom2"><span></span></label>
</div> </div>
@@ -429,4 +429,11 @@
<h5>Vui lòng điền đầy đủ thông tin trước khi tạo tài khoản.</h5> <h5>Vui lòng điền đầy đủ thông tin trước khi tạo tài khoản.</h5>
<button type="button" class="btn btn-primary" (click)="closeLayer2()">Tiếp tục</button> <button type="button" class="btn btn-primary" (click)="closeLayer2()">Tiếp tục</button>
</div> </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> </ng-template>
@@ -69,8 +69,10 @@ export class SignupComponent {
@ViewChild('error_modal') errorModal: TemplateRef<any>; @ViewChild('error_modal') errorModal: TemplateRef<any>;
@ViewChild('miss_info') missInfoModal: TemplateRef<any>; @ViewChild('miss_info') missInfoModal: TemplateRef<any>;
@ViewChild('miss_otp') missOTPModal: TemplateRef<any>; @ViewChild('miss_otp') missOTPModal: TemplateRef<any>;
@ViewChild('empty_phonenumber') emptyPhoneNumber: TemplateRef<any>;
//Phonenumber //Phonenumber
isSend: boolean = false;
isVerified: boolean = false; isVerified: boolean = false;
reCaptchaVerifier; reCaptchaVerifier;
verify; verify;
@@ -78,10 +80,8 @@ export class SignupComponent {
constructor( constructor(
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private authService: AuthService, private authService: AuthService,
private firebaseAuth: AngularFireAuth,
private districtService: DistrictService, private districtService: DistrictService,
private storage: AngularFireStorage, private storage: AngularFireStorage,
private shopService: ShopService,
private modalService: BsModalService, private modalService: BsModalService,
private router: Router, private router: Router,
private firebaseService: FirebaseService private firebaseService: FirebaseService
@@ -338,31 +338,43 @@ export class SignupComponent {
} }
getOTP() { getOTP() {
this.reCaptchaVerifier = new firebase.auth.RecaptchaVerifier( const reg: User = new User();
'recapcha', reg.phoneNumber = this.userPhoneNumber.value;
{
size: 'visible',
}
);
firebase if (this.userPhoneNumber.value == '') {
.auth() this.layer2 = this.modalService.show(this.emptyPhoneNumber, { class: 'modal-sm' });
.signInWithPhoneNumber('+84 ' + this.userPhoneNumber.value, this.reCaptchaVerifier) }
.then((confirmationResult) => { 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; firebase
.auth()
console.log("send code!"); .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 //Districts and Wards