Skip to content

Commit

Permalink
clarify comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hellobontempo committed Dec 16, 2024
1 parent 5b5d163 commit 14de658
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
18 changes: 10 additions & 8 deletions ui/app/components/auth/login-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,19 @@ export default class AuthLoginFormComponent extends Component {
}

/*
Checking for an mfa_requirement happens in two different places depending which <form> is submitted:
Checking for an mfa_requirement happens in two places.
Login methods submitted using a child of <AuthForm> have custom auth logic where mfa_requirements are collected, if any.
This mfa data is passed to their respective onSubmit callback functions and is eventually handled here.
If doSubmit in <AuthForm> is called directly (by the "default" <form> component) mfa is handled the parent <Auth::Page> component.
This mfa data is passed to their respective onSubmit callback functions, then intercepted here and passed up to
the parent <Auth::Page> component (which renders the Mfa::MfaForm).
If doSubmit in <AuthForm> is called directly (by the "default" <form> component)
mfa is handled directly by the parent <Auth::Page> component.
*/
if (data?.mfa_requirement) {
const mfa_requirement = this.auth._parseMfaResponse(data.mfa_requirement);
// calls onAuthResponse in auth/page.js
this.args.onSuccess(mfa_requirement, backendType, data);
// return here because mfa-form.js will finish login flow after mfa validation
const parsedMfaAuthResponse = this.auth._parseMfaResponse(data.mfa_requirement);
// calls onAuthResponse in parent auth/page.js component
this.args.onSuccess(parsedMfaAuthResponse, backendType, data);
// return here because mfa-form.js will finish login/authentication flow after mfa validation
return;
}

Expand Down
8 changes: 4 additions & 4 deletions ui/app/components/auth/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export default class AuthPage extends Component {
onAuthResponse(authResponse, backend, data) {
const { mfa_requirement } = authResponse;
/*
Checking for an mfa_requirement happens in two different places depending on which <form> is submitted:
If doSubmit in <AuthForm> is called directly (by the <form> component) mfa is handled here.
Checking for an mfa_requirement happens in two places.
If doSubmit in <AuthForm> is called directly (by the <form> component) mfa is just handled here.
Login methods submitted using a child form component of <AuthForm> are checked for mfa
in the Auth::LoginForm "authenticate" task
Login methods submitted using a child form component of <AuthForm> are first checked for mfa
in the Auth::LoginForm "authenticate" task, and then that data eventually bubbles up here.
*/
if (mfa_requirement) {
// if an mfa requirement exists further action is required
Expand Down

0 comments on commit 14de658

Please sign in to comment.