Patch for GitHub is never authorized Kubuntu 16.10 no crash (bug 372144)
ClosedPublic

Authored by WDavidO on Nov 17 2016, 5:49 AM.

Details

Summary

Patch appends local host name and current date time to personal access token generated for kdevelop github plugin so it doesn't fail despite correct credentials when another instance of kdevelop is already authorized on the same github account.

This may also fix bug https://bugs.kde.org/show_bug.cgi?id=360589 I don't have windows 8.1 and have never experienced a crash when previous authentications failed.

In addition to appending to the generated token names I created a more verbose failure message which displays the name that was attempted and a link to the github personal access tokens page and a similar information message when authentication succeeds so users are better able to manage the tokens they create. I also updated the VALID_ACCOUNT message to link to the personal access tokens section of github settings (where the created token will be listed) as opposed to the generic applications section.

The message boxs may be a bit overkill but would have saved me a lot of time in the original diagnosis of why tokens couldn't be created with the old method. That being said name collisions should be virtually impossible now so the messages could be slimmed down or omitted. I am reasonably concerned that someone could purge and reinstall kdevelop or something of that nature and have a number of stray access tokens without realising it so I decided to pursue a verbose approach.

Test Plan

Using machines A and B (virtual is acceptable) both with KDevelop installed and a github account that is authorized for any kdevelop installation.

authorize the github account with kdevelop on machine A and it will work.

Attempt to authorize the same account on machine B and it will not work without this patch. The error will also not give any indication as to why the authorization failed.

Diff Detail

Repository
R32 KDevelop
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
WDavidO updated this revision to Diff 8247.Nov 17 2016, 5:49 AM
WDavidO retitled this revision from to Patch for GitHub is never authorized Kubuntu 16.10 no crash (bug 372144).
WDavidO updated this object.
WDavidO edited the test plan for this revision. (Show Details)
WDavidO added a reviewer: KDevelop.
WDavidO set the repository for this revision to R32 KDevelop.
WDavidO added a project: KDevelop.
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptNov 17 2016, 5:49 AM
kfunk requested changes to this revision.Nov 17 2016, 8:16 AM
kfunk added a reviewer: kfunk.
kfunk added a subscriber: kfunk.

Thanks for working on this David! Much appreciated.

providers/ghprovider/ghdialog.cpp
118

const QString& please

128

Would be better to give this dialog a proper caption. There's a multi-QString-arg version of KMessageBox, see here: https://api.kde.org/frameworks/kwidgetsaddons/html/namespaceKMessageBox.html#a02dfebea27d2b3e28199aa543a4d012c.

Set both caption + text. Make sure casing is correct as well.

providers/ghprovider/ghresource.cpp
65 ↗(On Diff #8247)

Style: "" + a + b + ... (spaces between operator & operands)

151 ↗(On Diff #8247)

Style: Space after comma

153 ↗(On Diff #8247)

Dito, same in other places

This revision now requires changes to proceed.Nov 17 2016, 8:16 AM
WDavidO updated this revision to Diff 8275.Nov 17 2016, 2:46 PM
WDavidO edited edge metadata.
WDavidO removed R32 KDevelop as the repository for this revision.

I believe I fixed the previous issues without creating new ones :)

This revision was automatically updated to reflect the committed changes.