Skip to content

Commit

Permalink
Update: Use optional methods for auto 2fa
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayao0819 committed Nov 6, 2023
1 parent aea7b3a commit 2196992
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
14 changes: 12 additions & 2 deletions src/class/SSO/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@
import changeQueryInnerHTML from "../../utils/changeQueryInnerHTML";
import { GundaiWebSite } from "../UnivWebsite";

export const SSO = new GundaiWebSite("sso");
export const SSO = new GundaiWebSite<{
enableAuto2FA: () => void;
isAuto2FAEnabled: () => Promise<boolean>;
}>("sso");
export default SSO;

SSO.rainbow.enable = function () {
this.bg.apply(".input_form");
changeQueryInnerHTML(".product", "群馬大学ゲーミングサインオンシステム");

};
SSO.options.isAuto2FAEnabled = async (): Promise<boolean> => {
const isAuto2FAEnabled = await SSO.storage.get("auto-2fa");
return isAuto2FAEnabled;
};
SSO.options.enableAuto2FA = () => {
// 二段階認証の自動送信
if (location.pathname == "/pub/allotplogin_force.cgi") {
// 2段階認証のページ
Expand All @@ -24,3 +32,5 @@ SSO.rainbow.enable = function () {
});
}
};

SSO.addLoader(SSO.options.enableAuto2FA);
11 changes: 4 additions & 7 deletions src/options/pages/Top.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,10 @@ export default function Top() {
<QuickSwitch className="child:m-2" />
</ConfigSection>

<ConfigSection name="Detail" desc="ウェブサイトごとの詳細設定を行います">
<div className="flex flex-col">
<Heading.h3>SSO</Heading.h3>
<div className="flex">
<p>二段階認証コードの自動送信を行うかどうか</p>
<ToggleWithStorage section="sso" dataKey="auto-2fa" />
</div>
<ConfigSection name="SSO">
<div className="flex">
<p>二段階認証コードの自動送信</p>
<ToggleWithStorage section="sso" dataKey="auto-2fa" />
</div>
</ConfigSection>

Expand Down

0 comments on commit 2196992

Please sign in to comment.