From 14e35e1af0eaea34465a0be31aeef752c72b5af1 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 4 Jan 2021 17:15:29 +0000 Subject: [PATCH] ide: github token support git-svn-id: svn://ultimatepp.org/upp/trunk@15643 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/RepoSync.cpp | 7 ++++++- uppsrc/ide/urepo.lay | 7 ++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/uppsrc/ide/RepoSync.cpp b/uppsrc/ide/RepoSync.cpp index 3df0dd5b4..0fd2dfae3 100644 --- a/uppsrc/ide/RepoSync.cpp +++ b/uppsrc/ide/RepoSync.cpp @@ -24,11 +24,16 @@ int UrepoConsole::Git(const char *dir, const char *command, bool pwd) String username, password; if(url.StartsWith("https://") && GetCredentials(url, dir, username, password)) { String https = "https://"; - cmd << ' ' << https << UrlEncode(username) + ":"; + cmd << ' ' << https; + if(username.GetCount()) + cmd << UrlEncode(username) + ":"; int p = cmd.GetCount(); + DDUMP(password); + DDUMP(UrlEncode(password)); cmd << UrlEncode(password); HidePassword(p, cmd.GetCount()); cmd << "@" << url.Mid(https.GetCount()); + DDUMP(cmd); } } int code = CheckSystem(cmd); diff --git a/uppsrc/ide/urepo.lay b/uppsrc/ide/urepo.lay index f5d447490..cb0a43f3a 100644 --- a/uppsrc/ide/urepo.lay +++ b/uppsrc/ide/urepo.lay @@ -34,16 +34,17 @@ LAYOUT(GitOptionsLayout, 164, 16) ITEM(Upp::Option, pull, SetLabel(t_("Pull")).LeftPosZ(116, 48).VCenterPosZ(16, 0)) END_LAYOUT -LAYOUT(CredentialLayout, 368, 116) +LAYOUT(CredentialLayout, 368, 140) ITEM(Upp::Label, dv___0, SetLabel(t_("Url (or directory)")).LeftPosZ(8, 92).TopPosZ(8, 19)) ITEM(WithDropChoice, url, LeftPosZ(112, 248).TopPosZ(8, 19)) ITEM(Upp::Label, dv___2, SetLabel(t_("Username")).LeftPosZ(8, 92).TopPosZ(32, 19)) ITEM(Upp::EditString, username, LeftPosZ(112, 248).TopPosZ(32, 19)) - ITEM(Upp::Label, dv___4, SetLabel(t_("Password")).LeftPosZ(8, 92).TopPosZ(56, 19)) + ITEM(Upp::Label, dv___4, SetLabel(t_("Password / token")).LeftPosZ(8, 92).TopPosZ(56, 19)) ITEM(Upp::EditString, password, LeftPosZ(112, 248).TopPosZ(56, 19)) - ITEM(Upp::Option, show_password, SetLabel(t_("Show password")).LeftPosZ(8, 108).TopPosZ(84, 20)) + ITEM(Upp::Option, show_password, SetLabel(t_("Show password")).LeftPosZ(8, 108).TopPosZ(108, 20)) ITEM(Upp::Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(228, 64).BottomPosZ(8, 24)) ITEM(Upp::Button, ok, SetLabel(t_("OK")).LeftPosZ(296, 64).BottomPosZ(8, 24)) + ITEM(Upp::Label, dv___9, SetLabel(t_("Note: To use github OAuth token, leave the username empty")).SetFont(StdFont().Italic()).LeftPosZ(8, 360).TopPosZ(84, 19)) END_LAYOUT LAYOUT(PasskeyLayout, 368, 92)