Skip to content

Login abstract#13

Open
PetN5026 wants to merge 7 commits intomainfrom
loginAbstract
Open

Login abstract#13
PetN5026 wants to merge 7 commits intomainfrom
loginAbstract

Conversation

@PetN5026
Copy link
Copy Markdown
Collaborator

Summary

Describe the change.

Moved login function and handlepasskey function logic to be importable to allow front end dev to decide how to handle the responses.

Type of Change

  • [x ] Refactor

Checklist

  • Tests pass
  • [x ] No breaking changes
  • Docs updated (if needed)
  • Security implications considered

Copy link
Copy Markdown
Contributor

@Bccorb Bccorb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code needs to be cleaned up. Remove comments and ensure logs are cleaned up and function returns are standardized.

setShowFallbackOptions(true);
}
};
// const handlePasskeyLogin = async () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get rid of the commented out code.


if (mode === 'login') login();
if (mode === 'login') {
login(identifier, passkeyAvailable);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to wait for the response of this and validate it is correct before trying to do passkey login.

Comment on lines +111 to +122
if (!passkeyAvailable) {
// setShowFallbackOptions(true);
return response;
}

try {
return response;
} catch (err) {
console.error('Passkey login failed', err);
// setShowFallbackOptions(true);
return response;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk if you need any of this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was always told to try any api request. But I couldn't catch and return the response so I'll just remove the try for now.

Comment on lines +147 to +150
// navigate('/mfaLogin');
// need to return "Success"
// can just return a bool, if success true otherwise false anywhere else
return true;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get rid of the commented out code

return;
}
} catch (error) {
console.log(error);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to a console.error instead of console.log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants