A ternary method to enable calling either of the methods based on the condition - if the user is registed for any of the auth methods. When current user is registered for any of the supported auth method, then the 'registered' method is executed, otherwise - 'not_registered' method
(registered, not_registered)
| 195 | |
| 196 | |
| 197 | def mfa_user_registered(registered, not_registered) -> None: |
| 198 | """ |
| 199 | A ternary method to enable calling either of the methods based on the |
| 200 | condition - if the user is registed for any of the auth methods. |
| 201 | |
| 202 | When current user is registered for any of the supported auth method, then |
| 203 | the 'registered' method is executed, otherwise - 'not_registered' method is |
| 204 | executed. |
| 205 | |
| 206 | Args: |
| 207 | registered (Callable[[], None]) : Method to be executed when |
| 208 | registered. |
| 209 | not_registered (Callable[[], None]): Method to be executed when not |
| 210 | registered |
| 211 | |
| 212 | Returns: |
| 213 | None: Expecting the methods to return None as it will not be consumed. |
| 214 | |
| 215 | NOTE: Removed the typing anotation as it was giving errors. |
| 216 | """ |
| 217 | |
| 218 | return registered() if len(user_supported_mfa_methods()) > 0 else \ |
| 219 | not_registered() |
| 220 | |
| 221 | |
| 222 | def mfa_session_authenticated(authenticated, unauthenticated): |