Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CO-2677 - Add capability to generate, print, and delete Privacy Idea backup codes as an authenticator for a CO Person #525

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

shaynasings
Copy link
Collaborator

…es as an authenticator for a CO Person

@shaynasings shaynasings changed the title CO-2677 CO-2677 - Add capability to generate, print, and delete Privacy Idea backup codes as an authenticator for a CO Person Jul 31, 2023
*/

public function generate() {
if($this->request->is('get')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since everything happens inside an if you should better reverse the logic.

public function generate() {
  if(!$this->request->is('get')) {
     // what to return here??
  }

  // the rest of the logic
}

case PrivacyIDEATokenTypeEnum::TOTP:
$token['confirmed'] = false;
$TotpToken = new TotpToken();
$TotpToken->save($token);
Copy link
Contributor

Choose a reason for hiding this comment

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

What will happen if save fails?

break;
}

if(!$jresponse->result->status) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is probably not needed. The same check exists at line 193

$results = $this->TotpToken->find('all', $args);

if(empty($results)) {
unset($args);
Copy link
Contributor

@ioigoume ioigoume Aug 2, 2023

Choose a reason for hiding this comment

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

prefer not to unset the $args but to re-initialize it.

$args = array();

@shaynasings
Copy link
Collaborator Author

rebased again latest develop

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