File tree Expand file tree Collapse file tree
main/docs/authenticate/passwordless Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,16 +25,12 @@ const ipaddr = require('ipaddr.js');
2525exports .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};
You can’t perform that action at this time.
0 commit comments