Skip to content

Conversation

cdjenkins
Copy link

@ChristophWurst @MorrisJobke @boppy @killerbees19

Added code to use Plivo as a SMS Provider.

Copy link
Collaborator

@boppy boppy left a comment

Choose a reason for hiding this comment

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

Just minor thing (except for your switch of callback and src_number in Configure.php... Did this work for you?)...

@cdjenkins
Copy link
Author

Just minor thing (except for your switch of callback and src_number in Configure.php... Did this work for you?)...
I was able to run the command occ twofactorauth:gateway:configure sms sucessfully. What I'm not able to do is build the javascript files so I can enable it in personal settings of the user to test. Do you know how to build the javascript files with package.json? If I could do that, I could do an end-to-end test as I have a Plivo phone number.

@boppy
Copy link
Collaborator

boppy commented May 31, 2020

I was able to run the command occ twofactorauth:gateway:configure sms sucessfully. What I'm not able to do is build the javascript files so I can enable it in personal settings of the user to test. Do you know how to build the javascript files with package.json? If I could do that, I could do an end-to-end test as I have a Plivo phone number.

I'm the one with the dirty tricks, so my approach was simply to copy the changed files to my test-nextcloud's directory and test it there. No npm, etc... ;)

@cdjenkins
Copy link
Author

Yes, that is dirty...lolol but does work.

Copy link
Collaborator

@boppy boppy left a comment

Choose a reason for hiding this comment

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

This is only to prove that I have this petty German abilities to find something everywhere. Just give me a chance. :-D

Looks good to me!

Regarding Coding Style: I just remembered me running in the same "problem" - I'm far away from really knowing the guideline. But please don't tell anyone! ^^

Copy link
Author

@cdjenkins cdjenkins left a comment

Choose a reason for hiding this comment

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

Updated files as per comments

@cdjenkins cdjenkins requested a review from boppy June 2, 2020 18:38
@cdjenkins
Copy link
Author

cdjenkins commented Jun 3, 2020

@boppy @ChristophWurst I just setup a development server on my VPS. Once I figure out how to generate the build folder inside the js folder, I'll test the Plivo sms verification. From what I can tell, package.json requires me to install npm. On my prod server, I can enable 2FA. On my dev server, I can't. The difference is the build folder (from what I can tell).

@cdjenkins
Copy link
Author

So I decided to copy the build directory over to my dev server. I have the option now to enable!!!

One problem: I run the configure command and select plivo, enter the params, and the web interface no longer allows me to enable 2FA (i.e. no enable button). I runt the configure command again, select the defaults, and the web interface shows me the enable button.

@cdjenkins
Copy link
Author

I found a small bug in my code, which once fixes, the enable button appeared on the web interface. Now I get this: Could not verify your code. Please try again. Enter your identification (e.g. phone number to start the verification)

@cdjenkins
Copy link
Author

I fixed another issue. The code sent, but I never received it on my phone. @ChristophWurst @boppy Is there a way to log the URL call that is made?

@cdjenkins
Copy link
Author

I'm finally at the point where the code $this->client->post gives me and error ,but $this->client->get works. However, the plivo api needs for post to work. The error I get is OCA\TwoFactorGateway\Exception\VerificationTransmissionException: could not send verification code

@cdjenkins
Copy link
Author

Figured out the issue. Had an invalid param being passed to Plivo. I get the 2fa codes to my cell phone!! However, the web UI still says Could not verify your code. Please try again. Enter your identification (e.g. phone number to start the verification):

@cdjenkins
Copy link
Author

@ChristophWurst @boppy I have the debug flag set to the IClient which produces additional debug info to the ajax call. Removing the flag work!!

@cdjenkins
Copy link
Author

@ChristophWurst What else do I need to do so this PR can be merged?

@cdjenkins
Copy link
Author

cdjenkins commented Jun 14, 2020

Thanks for the approval! @boppy @ChristophWurst Should we be concerned that Travis CI doesn't pass all the tests? I took a look at the error codes, and it should to be unrelated to the source code.

Also, do I need to sign-off on my code?

@boppy
Copy link
Collaborator

boppy commented Jun 15, 2020

Should we be concerned that Travis CI doesn't pass all the tests? I took a look at the error codes, and it should to be unrelated to the source code.

While adding #346 I've also had those messages without a cause in my code. Since Christoph approved those, I think it's okay...

Also, do I need to sign-off on my code?

If you have the the tool chain at hand, I would totally recommend to sign any code you publish. And it's a 1-time-task to get this set up. You only have to touch it again if your signing key expires.

You might want to squash and sign...


@ChristophWurst I think those messages originate from the fact that nc/core#master is the 20 alpha already while 2fa has:

<nextcloud min-version="16" max-version="19"/>

Are there other problems you know of?

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

Some nitpicks

When you're done please squash the commit into one and add the sign-off :)

$this->logger->debug("api call: https://api.plivo.com/v1/Account/$authID/Message/" .print_r($apiParams,true));
$this->client->post("https://api.plivo.com/v1/Account/$authID/Message/", $apiParams);
} catch (Exception $ex) {
$this->logger->error($ex->getMessage());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$this->logger->error($ex->getMessage());
$this->logger->logException($ex, [
'message' => 'Could not send Plivo message: ' . $ex->getMessage(),
]);

then the logged line will also contain a trace

Copy link
Author

Choose a reason for hiding this comment

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

copy that. Given the 2 choices, when do you use error and when do you use logException?
@ChristophWurst @boppy

@ChristophWurst
Copy link
Member

@ChristophWurst I think those messages originate from the fact that nc/core#master is the 20 alpha already while 2fa has

Right. Please bump this to 20 and add a job to the Travis matrix that tests against stable19 in a separate PR :)

@cdjenkins
Copy link
Author

@ChristophWurst I think those messages originate from the fact that nc/core#master is the 20 alpha already while 2fa has

Right. Please bump this to 20 and add a job to the Travis matrix that tests against stable19 in a separate PR :)

Just to confirm, you are expecting @boppy to update the XML and Travis or myself?

Copy link
Author

@cdjenkins cdjenkins left a comment

Choose a reason for hiding this comment

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

I've reviewed, updated, and posted a new commit

@cdjenkins
Copy link
Author

cdjenkins commented Jun 16, 2020

I merged in the most recent changes from nextcloud/twofactor_gateway/master. I'll do another test on my dev server to be sure I can:

  1. Configure
  2. Receive SMS code
  3. Login correctly

If there are tests which handle this, please let me know.

@boppy Thanks for the links. Since I pushed my changes to my repo, can I still squash (i.e. rebase) the commits?

A word of caution: Only do this on commits that haven’t been pushed an external repository.

Copy link
Author

@cdjenkins cdjenkins left a comment

Choose a reason for hiding this comment

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

fixed requested changes

@ChristophWurst
Copy link
Member

@boppy Thanks for the links. Since I pushed my changes to my repo, can I still squash (i.e. rebase) the commits?

Yes! That should be fine.

Once this is merged you can reset your fork's master to ours or simply delete the fork repo because you're now allowed to push here directly :) Ideally features are developed on branches, so you can have more than one at a time and you master stays in sync with the upstream repo.

@cdjenkins
Copy link
Author

cdjenkins commented Jun 19, 2020

"and you master stays in sync with the upstream repo." Does github automatically handle this? master to master sync? A better question is, how to reset my fork?

@ChristophWurst
Copy link
Member

"and you master stays in sync with the upstream repo." Does github automatically handle this? master to master sync? A better question is, how to reset my fork?

No, it does not.

https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork I think that describes it well :)

Don't update the fork until this is merged, though, or you'll risk losing the commits.

@cdjenkins
Copy link
Author

https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork I think that describes it well :)

Don't update the fork until this is merged, though, or you'll risk losing the commits.

Thanks for the warning.

@vitormattos
Copy link
Collaborator

@cdjenkins can you fix the conflicts and DCO issues?
I think that when all tests pass, will be good to squash all commits in only one.

@vitormattos
Copy link
Collaborator

Thank you for your contribution and the time you put into this PR.

Since then, I’ve taken over as maintainer of this app, and it has gone through a major refactor that changed much of the internal architecture and file structure. Because of that, this PR can’t be merged in its current form.

If you’re still interested in this contribution, please feel free to rebase or open a new PR against the current main branch.

Your effort is very valuable, even if we can’t merge this directly, it helps us move the app forward. Thanks again!

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.

4 participants