-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
3,048 additions
and
5,074 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import User from "flarum/common/models/User"; | ||
|
||
declare module 'flarum/common/models/User' { | ||
export default interface User { | ||
mustEnable2FA: () => boolean; | ||
twoFactorEnabled: () => boolean; | ||
canDisable2FA: () => boolean; | ||
backupCodesRemaining: () => number; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import app from 'flarum/forum/app'; | ||
import TwoFactorEnableModal from './components/TwoFactorEnableModal'; | ||
|
||
export default function checkForTwoFactor() { | ||
return new Promise(() => { | ||
setTimeout(() => { | ||
if (app.session.user?.mustEnable2FA()) { | ||
app.modal.show(TwoFactorEnableModal, { user: app.session.user, forced: true }); | ||
} | ||
}, 300); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import app from 'flarum/forum/app'; | ||
import extendUserSecurityPage from './extendUserSecurityPage'; | ||
import extendLogInModal from './extendLogInModal'; | ||
import extendForumApplication from './extendForumApplication'; | ||
import checkForTwoFactor from './checkForTwoFactor'; | ||
|
||
export { default as extend } from './extend'; | ||
|
||
app.initializers.add('ianm/twofactor', () => { | ||
extendUserSecurityPage(); | ||
extendLogInModal(); | ||
extendForumApplication(); | ||
checkForTwoFactor(); | ||
}); |
Oops, something went wrong.