Skip to content

Commit a5b73af

Browse files
feat: ✨ github integration in frontend
1 parent 90e5505 commit a5b73af

9 files changed

Lines changed: 66 additions & 10 deletions

File tree

app/features/auth/templates/auth/login_form.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,19 @@
4444
</div>
4545
{% endif %}
4646

47-
<!-- Submit + ORCID -->
48-
<div class="d-flex align-items-center justify-content-between mb-4">
49-
{{ form.submit(class="btn btn-primary me-3") }}
47+
<!-- Submit + OAuth -->
48+
<div class="d-flex align-items-center justify-content-between mb-4 gap-2">
49+
{{ form.submit(class="btn btn-primary") }}
50+
<span class="text-muted">or</span>
51+
<a href="{{ url_for('github.login', next=next_url) if next_url else url_for('github.login') }}"
52+
class="btn btn-github d-flex align-items-center">
53+
GitHub
54+
</a>
5055
<span class="text-muted">or</span>
5156
<a href="{{ url_for('orcid.login', next=next_url) if next_url else url_for('orcid.login') }}"
5257
class="btn btn-orcid d-flex align-items-center">
53-
Login with ORCID
58+
ORCID
5459
</a>
55-
56-
5760
</div>
5861

5962
<!-- Signup / Forgot password -->

app/features/auth/templates/auth/signup_form.html

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,19 @@ <h5 class="card-title">Anti-bot filter</h5>
8686
</div>
8787
</div>
8888

89-
<!-- Submit + ORCID -->
90-
<div class="d-flex align-items-center justify-content-between mb-4">
91-
{{ form.submit(class="btn btn-primary me-3") }}
89+
<!-- Submit + OAuth -->
90+
<div class="d-flex align-items-center justify-content-between mb-4 gap-2">
91+
{{ form.submit(class="btn btn-primary") }}
9292
<span class="text-muted">or</span>
93+
<a href="{{ url_for('github.login', next=next_url) if next_url else url_for('github.login') }}"
94+
class="btn btn-github d-flex align-items-center"
95+
style="border-radius: 6px;">
96+
GitHub
97+
</a>
9398
<a href="{{ url_for('orcid.login', next=next_url) if next_url else url_for('orcid.login') }}"
9499
class="btn btn-orcid d-flex align-items-center"
95100
style="border-radius: 6px;">
96-
Sign up with ORCID
101+
ORCID
97102
</a>
98103
</div>
99104

app/features/github/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GITHUB_CLIENT_ID=<CHANGE_THIS>
2+
GITHUB_CLIENT_SECRET=<CHANGE_THIS>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("Hi, I am a script loaded from github module");
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const path = require('path');
2+
module.exports = {
3+
entry: path.resolve(__dirname, './scripts.js'),
4+
output: {
5+
filename: 'github.bundle.js',
6+
path: path.resolve(__dirname, '../dist'),
7+
},
8+
resolve: {
9+
fallback: {
10+
}
11+
},
12+
mode: 'development',
13+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{% extends "base_template.html" %}
2+
3+
{% block title %}View github{% endblock %}
4+
5+
{% block content %}
6+
7+
{% endblock %}
8+
9+
{% block scripts %}
10+
<script src="{{ url_for('github.assets', subfolder='js', filename='scripts.js') }}"></script>
11+
{% endblock %}

app/features/profile/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ class UserProfile(db.Model):
1111
surname = db.Column(db.String(100), nullable=False)
1212

1313
orcid = db.relationship("Orcid", backref="profile", uselist=False)
14+
github = db.relationship("Github", backref="profile", uselist=False)
1415

1516
def get_orcid(self):
1617
return self.orcid.orcid_id if self.orcid else None
18+
19+
def get_github(self):
20+
return self.github.github_login if self.github else None

app/features/profile/templates/profile/edit.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ <h3 class="card-title fw-bold">Edit your profile</h3>
5757
</div>
5858
{% endif %}
5959

60+
{% if profile.get_github() %}
61+
<div class="mb-4">
62+
<label class="form-label fw-semibold">GitHub</label>
63+
<input class="form-control" id="github" type="text" value="{{ profile.get_github() }}" readonly>
64+
<div class="form-text">Your GitHub account is linked via GitHub Login.</div>
65+
</div>
66+
{% endif %}
6067

6168
{% if error %}
6269
<div class="alert alert-danger d-flex align-items-center p-3 mb-4">

app/static/css/own.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,16 @@ a {
140140
border-color: #8fbf2f !important;
141141
}
142142

143+
.btn-github {
144+
background-color: #24292f !important;
145+
border-color: #24292f !important;
146+
color: #fff !important;
147+
}
148+
.btn-github:hover {
149+
background-color: #1a1e23 !important; /* darker shade on hover */
150+
border-color: #1a1e23 !important;
151+
}
152+
143153
/* ============================================================
144154
Skeleton placeholders — shared shimmer used for loading states
145155
in the main page, explore results, and dataset workbench.

0 commit comments

Comments
 (0)