Skip to content

Commit 791d509

Browse files
Apply suggestion from @hazel-nut
Co-authored-by: Hazel Virdó <hazel.virdo@okta.com>
1 parent 218a109 commit 791d509

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

main/docs/authenticate/passwordless/sample-use-cases-actions.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,12 @@ const ipaddr = require('ipaddr.js');
2525
exports.onExecutePostLogin = async (event, api) => {
2626
const corp_network = "192.168.1.134/26";
2727
const current_ip = ipaddr.parse(event.request.ip);
28-
// is auth method passwordless and IP outside corp network?
29-
const passwordlessOutside = event.authentication.methods.find(
30-
(method) => (
31-
((method.name === 'sms') || (method.name === 'email')) &&
32-
(!current_ip.match(ipaddr.parseCIDR(corp_network)))
33-
)
28+
const usesPasswordlessAuth = event.authentication.methods.some(
29+
(method) => method.name === 'sms' || method.name === 'email';
3430
);
31+
const outsideCorpNetwork = !current_ip.match(ipaddr.parseCIDR(corp_network));
3532

36-
// if yes, then require MFA
37-
if (passwordlessOutside) {
33+
if (usesPasswordlessAuth && outsideCorpNetwork) {
3834
api.multifactor.enable('any', { allowRememberBrowser: false });
3935
}
4036
};

0 commit comments

Comments
 (0)