PageSourceSearch

https://gpp.com.vn/Template/js/dangkytaikhoan.js?v=639265778563479875

js gpp.com.vn collected 2026-10-02 15:45:18 UTC 11,545 bytes, 306 lines download raw bytes

1var timer;
2var end;
3var soLanThucHien = 0;
4var getOtpCount = 0;
5var daNhanOTP = false;
6var isCheckedValidate = false;
7
8var keycheck = "";
9
10var lstBlackList = [ "0983730305"];
11
12function getCaptcha() {
13    $.ajax({
14        url: window.location.origin + '/account/GetCaptcha',
15        type: "GET",
16        contentType: "application/json; charset=utf-8",
17        dataType: 'json',
18        success: function (res) {
19            $("#captchaImage").attr("src", res.result.image);
20            keycheck = res.result.keycheck;
21        },
22        error: function (e) {
23            //abp.notify.success("error");
24        }
25    });
26}
27function openModalDangKy(magoi) {
28    $('#formDangKyNhaThuoc').modal('show');
29    var $form = $("#frmDangKyTaiKhoan");
30    getCaptcha();
31    var $validator = $form.validate();
32    var $errors = $form.find(".field-validation-error span");
33    $('#MaGoiCuocDangKy').val(magoi);
34    $('#MaXacThuc').prop('disabled', true);
35    getOtpCount = 0;
36    daNhanOTP = false;
37    $errors.each(function () { $validator.settings.success($(this)); })
38    $validator.resetForm();
39    if (!$("#CaptchaInput_error").hasClass("hidden")) {
40        $("#CaptchaInput_error").addClass("hidden");
41    }
42    isCheckedValidate = false;
43}
44
45
46
47function copyThongTin() {
48    $("#NguoiChiuTrachNhiemChuyenMon").val($("#NguoiDaiDien_Ten").val());
49    $("#NguoiChiuTrachNhiemChuyenMon_CMTND").val($("#NguoiDaiDien_CMND").val());
50    $("#NguoiChiuTrachNhiemChuyenMon_SoDienThoai").val($("#NguoiDaiDien_SoDienThoai").val());
51    $("#NguoiChiuTrachNhiemChuyenMon_Email").val($("#NguoiDaiDien_Email").val());
52}
53
54
55function OnFailureDangKy() {
56    $('#noti_dangkynhathuoc').removeClass('bg-green');
57    $('#noti_dangkynhathuoc').addClass('bg-yellow');
58    document.getElementById('noidungthongbao_dangkynhathuoc').innerText = "Lỗi!";
59    $('#thongBaoThanhCong').modal('show');
60    abp.ui.clearBusy("#formDangKyNhaThuoc");
61}
62
63function oncloseModalDangKyTaiKhoan() {
64    end = new Date();
65    $('#nhanMaXacThucBtn').html('Nhận mã xác thực qua SMS');
66    $('#MaXacThuc').prop('disabled', true);
67    getOtpCount = 0;
68    daNhanOTP = false;
69}
70
71function OnSuccessDangKy(data, status, xhr) {
72    if (data.result.success) {
73        window.location.href = window.location.origin + "/Account/RegisterSuccess";
74        //$('#noti').removeClass('bg-yellow');
75        //$('#noti').addClass('bg-green');
76        //$('#frmDangKyTaiKhoan')[0].reset();
77        //$('#formDangKyNhaThuoc').modal('hide');
78        //$('#thongBaoThanhCong').modal('show');
79        //document.getElementById('noidungthongbao').innerHTML = "Đăng ký tài khoản thành công vui lòng kiểm tra email để xác thực tài khoản.";
80
81    } else {
82        if (data.result.isValidOtp) {
83            $('#noti_dangkynhathuoc').removeClass('bg-green');
84            $('#noti_dangkynhathuoc').addClass('bg-yellow');
85            document.getElementById('noidungthongbao_dangkynhathuoc').innerText = data.result.errorMessage;
86            $('#thongBaoThanhCong').modal('show');
87        } else {
88            
89            var maXacThuc = $("#MaXacThuc").val();
90            if (maXacThuc && maXacThuc.trim()) {
91                if (data.result.otpErrorCode == '401') {
92                    $('#thongBaoLbl').html('Số điện thoại không hợp lệ. Quý khách vui lòng kiểm tra lại.');
93                } else {
94                    if (soLanThucHien < 5) {
95                        if (data.result.otpErrorCode == '404') {
96                            $('#thongBaoLbl').html('Mã OTP không chính xác. Quý khách vui lòng nhập lại.');
97                        }
98                        if (data.result.otpErrorCode == '410') {
99                            $('#thongBaoLbl').html('Mã OTP đã hết hạn. Quý khách vui lòng thực hiện gửi lại mã OTP.');
100                        }
101                    } else {
102                        if (data.result.otpErrorCode == '404') {
103                            $('#thongBaoLbl').html('Mã OTP không chính xác. Quý khách sẽ được chuyển về màn hình trang chủ.');
104                        }
105                        if (data.result.otpErrorCode == '410') {
106                            $('#thongBaoLbl').html('Mã OTP đã hết hạn. Quý khách vui lòng thử lại sau.');
107                        }
108                        window.location.href = window.location.origin;
109                    }
110                    soLanThucHien++;
111                }
112            } else {
113                if (daNhanOTP) {
114                    $('#thongBaoLbl').html('Vui lòng nhập mã xác thực ');
115                } else {
116                    $('#thongBaoLbl').html(`Vui lòng nhập <strong>Mã xác thực</strong> bằng cách bấm <strong>Nhận mã xác thực qua SMS</strong>`);
117                }
118            }
119        }
120        abp.ui.clearBusy("#formDangKyNhaThuoc");
121    }
122}
123
124function blockFromDangKyNhaThuoc() {
125    
126    abp.ui.setBusy("#formDangKyNhaThuoc");
127}
128
129function checkValidateCaptCha() {
130    if (isCheckedValidate) {
131        setTimeout(function () {
132            var captcha = $("#txtCaptcha").val();
133            if (captcha == null || captcha == '') {
134                $("#CaptchaInput_error").removeClass("hidden");
135                return;
136            }
137            else {
138                $("#CaptchaInput_error").addClass("hidden");
139            }
140        },20)      
141    }
142}
143
144function guiMaXacThuc() {
145    isCheckedValidate = true;
146    var isValid = $("#frmDangKyTaiKhoan").valid();
147    if (!isValid) {
148        checkValidateCaptCha();
149        return;
150    }
151    else {
152        checkValidateCaptCha();
153    }
154    
155
156    var soDienThoai = $("#NguoiDaiDien_SoDienThoai").val();
157    var pattern = "^(\\+84[3|5|7|8|9]|84[3|5|7|8|9]|0[3|5|7|8|9])+([0-9]{8})\\b";
158    var captcha = $("#txtCaptcha").val();
159
160
161    var isValid = (new RegExp(pattern)).test(soDienThoai);
162    if (!isValid) {
163        $('#thongBaoLbl').html('Số điện thoại không hợp lệ. Vui lòng nhập lại số điện thoại');
164    } else {
165        if (getOtpCount >= 5) {
166            abp.message.error("Đã quá số lần lấy lại mã OTP, quý khách vui lòng thử lại sau", " ");
167            $("#formDangKyNhaThuoc").modal('toggle');
168            return;
169        }
170
171        if (lstBlackList.includes(convertStandardPhoneNumber(soDienThoai))) {
172            $('#thongBaoLbl').html('Số điện thoại không hợp lệ. Vui lòng nhập lại số điện thoại');
173            return;
174        }
175
176        $('#thongBaoLbl').html("");
177
178        $.ajax({
179            url:  window.location.origin + '/account/LayMaXacThucDangKyTaiKhoan',
180            type: "POST",
181            contentType: "application/json; charset=utf-8",
182            dataType: 'json',
183            data: JSON.stringify({
184                soDienThoai: soDienThoai,
185                KeyCheck: keycheck,
186                Captcha: captcha
187            }),
188            success: function (res) {
189                console.log('guiMaXacThuc result: ', res);
190                if (res.result.success) {
191                    if (daNhanOTP) {
192                        getOtpCount++;
193                    }
194                    daNhanOTP = true;
195                    var soDienThoaiHienThi = convertSoDienThoai(soDienThoai);
196                    $('#thongBaoLbl').html('Vui lòng nhập mã xác thực được gửi về số điện thoại ' + soDienThoaiHienThi + ' để hoàn tất quá trình đăng ký');
197                    end = new Date();
198                    end = new Date(end.getTime() + 179000);
199                    $('#nhanMaXacThucBtn').html('Gửi lại mã xác thực');
200                    $('#nhanMaXacThucBtn').prop('disabled', true);
201                    $('#MaXacThuc').prop('disabled', false);
202                    timer = setInterval(hienThiDongHoDemNguoc, 500);
203                } else {
204                    $('#thongBaoLbl').html(res.result.errorMessage);
205                }
206            },
207            error: function (e) {
208                //abp.notify.success("error");
209            }
210        });
211    }
212}
213
214function convertSoDienThoai(soDienThoai) {
215    var result = soDienThoai;
216    var patternLeadingZero = "^(0[3|5|7|8|9])+([0-9]{8})\\b";
217    var patternWithoutPlus = "^(84[3|5|7|8|9])+([0-9]{8})\\b";
218    var isLeadingZero = (new RegExp(patternLeadingZero)).test(soDienThoai);
219    var isWithoutPlus = (new RegExp(patternWithoutPlus)).test(soDienThoai);
220    if (isLeadingZero) {
221        result = "+84" + soDienThoai.slice(1);
222    }
223    else if (isWithoutPlus) {
224        result = "+" + soDienThoai;
225    }
226    result = result.substring(0, 3) + " " + result.substring(3, 6) + " " + result.substring(6, 9) + " " + result.substring(9, 12);
227    return result;
228}
229
230
231function convertStandardPhoneNumber(soDienThoai) {
232    soDienThoai = String(soDienThoai).trim();
233    soDienThoai = soDienThoai.replace(/[\s.-]/g, '');
234    if (soDienThoai.startsWith('+84')) {
235        soDienThoai = '0' + soDienThoai.slice(3);
236    }
237    else if (soDienThoai.startsWith('84')) {
238        soDienThoai = '0' + soDienThoai.slice(2);
239    }
240    return soDienThoai;
241}
242
243
244
245function ValidateNumber(e) {
246    var evt = (e) ? e : window.event;
247    var charCode = (evt.keyCode) ? evt.keyCode : evt.which;
248    if (charCode == 107
249        || charCode == 8
250        || charCode == 9
251        || charCode == 37
252        || charCode == 39
253        || charCode == 123
254        || charCode == 116
255        || (charCode == 187 && e.shiftKey)
256        || (charCode == 67 && e.ctrlKey)
257        || (charCode == 65 && e.ctrlKey)
258        || (charCode == 86 && e.ctrlKey)
259        || (charCode == 88 && e.ctrlKey)
260        || (charCode == 90 && e.ctrlKey)
261        || (charCode > 47 && charCode < 58 && !e.shiftKey)
262        || (charCode > 95 && charCode < 106)) {
263        return true;
264    } else {
265        return false;
266    }
267
268};
269
270function hienThiDongHoDemNguoc() {
271    var now = new Date();
272    var dif = end.getTime() - now.getTime();
273    var distance = Math.ceil(dif / 1000);
274    if (distance < 0) {
275        clearInterval(timer);
276        $('#thongBaoLbl').html('Nếu quý khách không nhận được tin nhắn, vui lòng bấm Gửi lại mã xác thực');
277        $('#nhanMaXacThucBtn').prop('disabled', false);
278        return;
279    }
280    var minute = Math.floor(distance / 60);
281    document.getElementById('countdown').innerHTML = (minute < 10 ? '0' : minute) + Math.floor(distance / 60) + ':' + ((distance % 60) < 10 ? '0' : '') + (distance % 60);
282}
283
284function onChangeTinh(ccbId, tinhId) {
285    //loaddataforHuyen($(ccbId), tinhId);
286
287    var skillsSelect = document.getElementById("TinhID");
288    var selectedText = skillsSelect.options[skillsSelect.selectedIndex].text;
289    $("#Tinh").val(selectedText);
290}
291
292function onChangeHuyen(ccbId, cbbTinh, huyenId) {
293    var tinhId = $(cbbTinh).val();
294    //loaddataforXa($(ccbId), tinhId, huyenId);
295
296    var skillsSelect = document.getElementById("HuyenID");
297    var selectedText = skillsSelect.options[skillsSelect.selectedIndex].text;
298    $("#Huyen").val(selectedText);
299}
300
301function onChangeXa(value) {
302    var skillsSelect = document.getElementById("XaID");
303    var selectedText = skillsSelect.options[skillsSelect.selectedIndex].text;
304    $("#Xa").val(selectedText);
305}
306

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.