Skip to content
This repository has been archived by the owner on Feb 20, 2022. It is now read-only.

Commit

Permalink
修正 驗證器 創建系統
Browse files Browse the repository at this point in the history
  • Loading branch information
xiao-e-yun committed Jul 10, 2021
1 parent 6734a16 commit b40b27a
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 116 deletions.
1 change: 0 additions & 1 deletion .LOCK
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
0
5 changes: 3 additions & 2 deletions app/gui/css/page/guard.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
background-color: rgb(var(--side-2));
position: relative;
}
#reload_line > #last_time {

#last_time {
background-color: rgb(var(--main));
position: absolute;
right: 0;
top: 0;
height: 100%;
height: 2px;
width: 100%;
}

Expand Down
16 changes: 15 additions & 1 deletion app/gui/css/request/guard$create.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,23 @@ input {
border-radius: 0;
}

#finish_input {
#finish_from {
margin: 1em 5em;
padding: 0.2em;
display: flex;
}

#finish_input {
margin: 0;
}

#finish_btn {
margin: 0;
border-radius: 0;
}

#skip_btn {
margin: 0 2em;
}

.iti__country-list {
Expand Down
95 changes: 50 additions & 45 deletions app/gui/js/request/guard$create-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
w = 600;
h = 400;
let list = $(".user_list");
let exited = true;
list.fadeOut(300, async () => {
list.remove();
resizeTo(w, h);
//開始
console.log("====================================已接管=");
document.title = `正在為 ${main_data.name} 設置驗證器`;
$(window).on('beforeunload', async function () {
return exited ? true : undefined;
return true;
});
if (await eel.guard_phone("has_phone", main_data.steamid)()) {
set_guard();
Expand All @@ -37,55 +36,49 @@ list.fadeOut(300, async () => {
initialCountry: "tw",
});
$("#submit_phone").on("click", function () {
if (iti.isValidNumber()) {
let num = iti.getNumber();
Einfo(num, "", "console");
eel.guard_phone('add_phone', main_data.steamid, num)().then((can) => {
if (can) {
main.fadeOut(300, () => {
main.html(/*html*/ `
if (!iti.isValidNumber()) {
return info('無效電話');
}
let num = iti.getNumber();
Einfo(num, "", "console");
eel.guard_phone('add_phone', main_data.steamid, num)().then((can) => {
if (!can) {
return info('未知錯誤');
}
main.fadeOut(300, () => {
main.html(/*html*/ `
<h2 class="title">確認電話號碼</h2>
<p class="main_info">請先確認電子郵件</p>
<button id="next_step_mail">下一步</button>
`).fadeIn();
$('#next_step_mail').on("click", async function () {
let has = await eel.guard_phone('cfm_mail', main_data.steamid)();
$('#next_step_mail').on("click", async function () {
let has = await eel.guard_phone('cfm_mail', main_data.steamid)();
if (has) {
return info('請先確認電子郵件');
}
main.fadeOut(300, () => {
main.html(/*html*/ `
<h2 class="title">確認電話號碼</h2>
<p class="main_info">請查看您的手機訊息</p>
<input type="text" id="cfm_phone" placeholder="輸入手機訊息驗證碼">
<button id="next_step_SMS">下一步</button>
`).fadeIn();
$('#next_step_SMS').on("click", async function () {
let num = $("#cfm_phone").val();
let has = await eel.guard_phone('cfm_phone_num', main_data.steamid, num)();
if (has) {
main.fadeOut(300, () => {
main.html(/*html*/ `
<h2 class="title">確認電話號碼</h2>
<p class="main_info">請查看您的手機訊息</p>
<input type="text" id="cfm_phone" placeholder="輸入手機訊息驗證碼">
<button id="next_step_SMS">下一步</button>
`).fadeIn();
$('#next_step_SMS').on("click", async function () {
let num = $("#cfm_phone").val();
let has = await eel.guard_phone('cfm_phone_num', main_data.steamid, num)();
if (has) {
main.fadeOut(500, () => {
set_guard(main);
});
}
else {
info('請輸入正確驗證碼');
}
});
main.fadeOut(500, () => {
set_guard(main);
});
}
else {
info('請先確認電子郵件');
info('請輸入正確驗證碼');
}
});
});
}
else {
info('未知錯誤');
}
});
});
}
else {
info('無效電話');
}
});
});
});
}
Expand All @@ -111,18 +104,30 @@ list.fadeOut(300, async () => {
root.html(/*html*/ `
<h2 class="title">將身份驗證器添加到帳戶</h2>
<p>你的電話號碼將收到簡訊代碼<br>此時你可以同時將新增驗證器在手機</p>
<input id="finish_input" placeholder="請輸入簡訊代碼"></input>
<div id="finish_from">
<input id="finish_input" placeholder="請輸入簡訊代碼">
<button id="finish_btn">完成</button>
</div>
<button id="skip_btn">已在手機上新增驗證器</button>
`).fadeIn();
$("#finish_input").on("change", function () {
eel.guard_phone('finalize', main_data.steamid, $(this).val())()
$("#finish_btn").on("click", function () {
info('正在驗證中');
eel.guard_phone('finalize', main_data.steamid, $("#finish_input").val())()
.then((bol) => {
if (bol) {
opener["reload_guard_account"]();
exited = false;
close();
finish();
}
});
});
$("#skip_btn").on("click", function () {
finish();
});
function finish() {
console.log("註冊成功");
$(window).off("beforeunload");
opener["reload_guard_account"]();
close();
}
});
}
else {
Expand Down
16 changes: 8 additions & 8 deletions scss/page/guard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
height: .3em;
background-color: BScolor($side-2);
position: relative;
&>#last_time{
background-color: BScolor($main);
position: absolute;
right: 0;
top: 0;
height: 100%;
width: 100%;
}
}
#last_time{
background-color: BScolor($main);
position: absolute;
right: 0;
top: 0;
height: 2px;
width: 100%;
}
#Gaccount {
margin-top: .3em;
Expand Down
15 changes: 13 additions & 2 deletions scss/request/guard$create.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,20 @@ input{
border-width: 0 0 2px 0;
border-radius: 0;
}
#finish_input{
#finish_from{
margin: 1em 5em;
padding: .2em;
padding: 0.2em;
display: flex;
}
#finish_input{
margin:0;
}
#finish_btn{
margin: 0;
border-radius: 0;
}
#skip_btn{
margin: 0 2em;
}

.iti__country-list {
Expand Down
Loading

0 comments on commit b40b27a

Please sign in to comment.