Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gitea support #8131

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix login
  • Loading branch information
anbraten committed Mar 7, 2022
commit bd3bc1578c7515b3dd2beada19f9f7ef20224bfa
10 changes: 3 additions & 7 deletions components/server/src/gitea/gitea-auth-provider.ts
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@
...oauth,
authorizationUrl: oauth.authorizationUrl || defaultUrls.authorizationUrl,
tokenUrl: oauth.tokenUrl || defaultUrls.tokenUrl,
// settingsUrl: oauth.settingsUrl || defaultUrls.settingsUrl,
settingsUrl: oauth.settingsUrl || defaultUrls.settingsUrl,
scope: GiteaScope.All.join(scopeSeparator),
scopeSeparator
};
@@ -52,20 +52,16 @@
super.authorize(req, res, next, scope ? scope : GiteaScope.Requirements.DEFAULT);
}

protected get baseURL() {
return `https://${this.params.host}`;
}

protected readAuthUserSetup = async (accessToken: string, tokenResponse: object) => {
const api = Gitea.create(this.baseURL, accessToken);
const api = Gitea.create(this.params.host, accessToken);
const getCurrentUser = async () => {
const response = await api.user.userGetCurrent();
return response.data as unknown as Gitea.User;
}
try {
const result = await getCurrentUser();
if (result) {
if (!result.active || !result.created || !result.prohibit_login) {
if (!result.active || result.prohibit_login) {
throw UnconfirmedUserException.create("Please confirm and activate your Gitea account and try again.", result);
}
}