@@ -420,8 +420,10 @@ pub(crate) async fn get(
420420                    & context, 
421421                    provider. claims_imports . displayname . is_required ( ) , 
422422                ) ? { 
423-                     Some ( value)  => ctx
424-                         . with_display_name ( value,  provider. claims_imports . displayname . is_forced ( ) ) , 
423+                     Some ( value)  => ctx. with_display_name ( 
424+                         value, 
425+                         provider. claims_imports . displayname . is_forced_or_required ( ) , 
426+                     ) , 
425427                    None  => ctx, 
426428                } 
427429            } ; 
@@ -442,7 +444,9 @@ pub(crate) async fn get(
442444                    & context, 
443445                    provider. claims_imports . email . is_required ( ) , 
444446                ) ? { 
445-                     Some ( value)  => ctx. with_email ( value,  provider. claims_imports . email . is_forced ( ) ) , 
447+                     Some ( value)  => { 
448+                         ctx. with_email ( value,  provider. claims_imports . email . is_forced_or_required ( ) ) 
449+                     } 
446450                    None  => ctx, 
447451                } 
448452            } ; 
@@ -541,9 +545,9 @@ pub(crate) async fn get(
541545                            // The username passes the policy check, add it to the context 
542546                            ctx. with_localpart ( 
543547                                localpart, 
544-                                 provider. claims_imports . localpart . is_forced ( ) , 
548+                                 provider. claims_imports . localpart . is_forced_or_required ( ) , 
545549                            ) 
546-                         }  else  if  provider. claims_imports . localpart . is_forced ( )  { 
550+                         }  else  if  provider. claims_imports . localpart . is_forced_or_required ( )  { 
547551                            // If the username claim is 'forced' but doesn't pass the policy check, 
548552                            // we display an error message. 
549553                            // TODO: translate 
@@ -678,7 +682,7 @@ pub(crate) async fn post(
678682            let  context = context. build ( ) ; 
679683
680684            // `is_forced` checks both if is it `force` or `require` 
681-             if  !provider. claims_imports . localpart . is_forced ( )  { 
685+             if  !provider. claims_imports . localpart . is_forced_or_required ( )  { 
682686                //Claims import for `localpart` should be `require` or `force` at this stage 
683687                return  Err ( RouteError :: InvalidFormAction ) ; 
684688            } 
@@ -793,7 +797,7 @@ pub(crate) async fn post(
793797            let  ctx = if  let  Some ( ref  display_name)  = display_name { 
794798                ctx. with_display_name ( 
795799                    display_name. clone ( ) , 
796-                     provider. claims_imports . email . is_forced ( ) , 
800+                     provider. claims_imports . email . is_forced_or_required ( ) , 
797801                ) 
798802            }  else  { 
799803                ctx
@@ -818,12 +822,15 @@ pub(crate) async fn post(
818822            } ; 
819823
820824            let  ctx = if  let  Some ( ref  email)  = email { 
821-                 ctx. with_email ( email. clone ( ) ,  provider. claims_imports . email . is_forced ( ) ) 
825+                 ctx. with_email ( 
826+                     email. clone ( ) , 
827+                     provider. claims_imports . email . is_forced_or_required ( ) , 
828+                 ) 
822829            }  else  { 
823830                ctx
824831            } ; 
825832
826-             let  username = if  provider. claims_imports . localpart . is_forced ( )  { 
833+             let  username = if  provider. claims_imports . localpart . is_forced_or_required ( )  { 
827834                let  template = provider
828835                    . claims_imports 
829836                    . localpart 
@@ -840,7 +847,7 @@ pub(crate) async fn post(
840847
841848            let  ctx = ctx. with_localpart ( 
842849                username. clone ( ) , 
843-                 provider. claims_imports . localpart . is_forced ( ) , 
850+                 provider. claims_imports . localpart . is_forced_or_required ( ) , 
844851            ) ; 
845852
846853            // Validate the form 
0 commit comments