From 4372579bff5c7f62fc257fcd9dd1120d9c0e1ebc Mon Sep 17 00:00:00 2001 From: Vladimir D Date: Fri, 6 Dec 2024 20:51:35 +0400 Subject: [PATCH 1/2] checklist added to CloudronManifest, CLOUDRON_OIDC_PROVIDER_NAME implemented --- CloudronManifest.json | 7 ++++++- POSTINSTALL.md | 2 -- start.sh | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CloudronManifest.json b/CloudronManifest.json index cf03c47..4f9ec1e 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -49,7 +49,12 @@ ], "changelog": "file://CHANGELOG.md", "postInstallMessage": "file://POSTINSTALL.md", - "minBoxVersion": "7.5.1", + "checklist": { + "change-default-password": { + "message": "Change the default admin password" + } + }, + "minBoxVersion": "8.1.0", "forumUrl": "https://forum.cloudron.io/category/19/gitea", "documentationUrl": "https://docs.cloudron.io/apps/gitea/" } diff --git a/POSTINSTALL.md b/POSTINSTALL.md index 4ec3c9d..c5cb1a5 100644 --- a/POSTINSTALL.md +++ b/POSTINSTALL.md @@ -3,8 +3,6 @@ This app is pre-setup with an admin account. The initial credentials are: **Username**: root
**Password**: changeme
-Please change the admin password immediately. - Use the `Local` authentication source for logging in as admin. diff --git a/start.sh b/start.sh index eeb9522..4651a61 100755 --- a/start.sh +++ b/start.sh @@ -11,7 +11,7 @@ setup_oidc_source() { now=$(date +%s) mysql -u"${CLOUDRON_MYSQL_USERNAME}" -p"${CLOUDRON_MYSQL_PASSWORD}" -h mysql --database="${CLOUDRON_MYSQL_DATABASE}" -e \ - "REPLACE INTO login_source (id, type, name, is_active, cfg, created_unix, updated_unix) VALUES (1,6,'cloudron', 1,'{\"Provider\":\"openidConnect\",\"ClientID\":\"${CLOUDRON_OIDC_CLIENT_ID}\",\"ClientSecret\":\"${CLOUDRON_OIDC_CLIENT_SECRET}\",\"OpenIDConnectAutoDiscoveryURL\":\"${CLOUDRON_OIDC_ISSUER}/.well-known/openid-configuration\",\"CustomURLMapping\":null,\"IconURL\":\"\",\"Scopes\":[\"openid email profile\"],\"RequiredClaimName\":\"\",\"RequiredClaimValue\":\"\",\"GroupClaimName\":\"\",\"AdminGroup\":\"\",\"GroupTeamMap\":\"\",\"GroupTeamMapRemoval\":false,\"RestrictedGroup\":\"\"}','${now}','${now}')" + "REPLACE INTO login_source (id, type, name, is_active, cfg, created_unix, updated_unix) VALUES (1,6,'${CLOUDRON_OIDC_PROVIDER_NAME:-Cloudron}', 1,'{\"Provider\":\"openidConnect\",\"ClientID\":\"${CLOUDRON_OIDC_CLIENT_ID}\",\"ClientSecret\":\"${CLOUDRON_OIDC_CLIENT_SECRET}\",\"OpenIDConnectAutoDiscoveryURL\":\"${CLOUDRON_OIDC_ISSUER}/.well-known/openid-configuration\",\"CustomURLMapping\":null,\"IconURL\":\"\",\"Scopes\":[\"openid email profile\"],\"RequiredClaimName\":\"\",\"RequiredClaimValue\":\"\",\"GroupClaimName\":\"\",\"AdminGroup\":\"\",\"GroupTeamMap\":\"\",\"GroupTeamMapRemoval\":false,\"RestrictedGroup\":\"\"}','${now}','${now}')" } setup_root_user() { From 33135d2354002a6846d03e2efc36ba7316002244 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Mon, 9 Dec 2024 09:57:55 +0100 Subject: [PATCH 2/2] Fix test --- test/test.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/test.js b/test/test.js index ba1a57c..5316619 100755 --- a/test/test.js +++ b/test/test.js @@ -29,7 +29,6 @@ describe('Application life cycle test', function () { const SSH_PORT = 29420; let app, browser; - let athenticated_by_oidc = false; const repodir = '/tmp/testrepo'; const reponame = 'testrepo'; @@ -108,24 +107,21 @@ describe('Application life cycle test', function () { await login('root', 'changeme'); } - async function loginOIDC(username, password) { + async function loginOIDC(username, password, alreadyAuthenticated = true) { browser.manage().deleteAllCookies(); await browser.get(`https://${app.fqdn}/user/login`); await browser.sleep(2000); - - await browser.findElement(By.xpath('//a[contains(@class, "openidConnect") and contains(., "Sign in with cloudron")]')).click(); + await browser.findElement(By.xpath('//a[contains(@href, "/user/oauth2/Cloudron")]')).click(); await browser.sleep(2000); - if (!athenticated_by_oidc) { + if (!alreadyAuthenticated) { await waitForElement(By.xpath('//input[@name="username"]')); await browser.findElement(By.xpath('//input[@name="username"]')).sendKeys(username); await browser.findElement(By.xpath('//input[@name="password"]')).sendKeys(password); await browser.sleep(2000); await browser.findElement(By.id('loginSubmitButton')).click(); await browser.sleep(2000); - - athenticated_by_oidc = true; } await waitForElement(By.xpath('//img[contains(@class, "avatar")]')); @@ -219,7 +215,7 @@ describe('Application life cycle test', function () { it('can send mail', sendMail); it('can logout', logout); - it('can login', loginOIDC.bind(null, username, password)); + it('can login', loginOIDC.bind(null, username, password, false)); it('can set avatar', setAvatar); it('can get avatar', checkAvatar);