Skip to content

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

Open
shaynasings wants to merge 3 commits into
Internet2:developfrom
shaynasings:CO-2677
Open

CO-2677 - Add capability to generate, print, and delete Privacy Idea backup codes as an authenticator for a CO Person#525
shaynasings wants to merge 3 commits into
Internet2:developfrom
shaynasings:CO-2677

Conversation

@shaynasings
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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