first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 22:20:45 +03:00
commit d50f14bcb1
681 changed files with 65020 additions and 0 deletions

View File

@@ -0,0 +1,353 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GitHub OAuth Test</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #24292e 0%, #1a1e22 100%);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}
.container {
background: white;
border-radius: 20px;
box-shadow: 0 20px 60px rgba(0,0,0,0.5);
padding: 40px;
max-width: 600px;
width: 100%;
}
h1 {
color: #24292e;
margin-bottom: 10px;
text-align: center;
}
.subtitle {
color: #666;
text-align: center;
margin-bottom: 30px;
font-size: 14px;
}
.info-box {
background: #f6f8fa;
border: 2px solid #e1e4e8;
border-radius: 8px;
padding: 20px;
margin-bottom: 20px;
}
.info-box h3 {
color: #24292e;
margin-bottom: 10px;
font-size: 16px;
}
.info-box ol {
margin-left: 20px;
color: #586069;
font-size: 14px;
line-height: 1.8;
}
.info-box code {
background: #fff;
padding: 2px 6px;
border-radius: 3px;
font-family: 'Courier New', monospace;
font-size: 12px;
border: 1px solid #e1e4e8;
}
.input-group {
margin-bottom: 20px;
}
.input-group label {
display: block;
color: #24292e;
font-weight: 600;
margin-bottom: 8px;
font-size: 14px;
}
.input-group input {
width: 100%;
padding: 12px 15px;
border: 2px solid #e1e4e8;
border-radius: 6px;
font-size: 14px;
font-family: 'Courier New', monospace;
transition: border-color 0.3s;
}
.input-group input:focus {
outline: none;
border-color: #0366d6;
}
.btn {
width: 100%;
padding: 15px 20px;
margin: 10px 0;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
}
.btn:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.btn-github {
background: #24292e;
color: white;
}
.btn-github:hover {
background: #1a1e22;
}
.btn-github:disabled {
background: #6a737d;
cursor: not-allowed;
transform: none;
}
.result {
margin-top: 30px;
padding: 20px;
background: #f8f9fa;
border-radius: 8px;
display: none;
}
.result.show {
display: block;
}
.result h3 {
color: #333;
margin-bottom: 10px;
}
.result.success {
background: #d4edda;
border: 2px solid #c3e6cb;
color: #155724;
}
.result.error {
background: #f8d7da;
border: 2px solid #f5c6cb;
color: #721c24;
}
.json-output {
background: #2d2d2d;
color: #f8f8f2;
padding: 15px;
border-radius: 5px;
overflow-x: auto;
font-family: 'Courier New', monospace;
font-size: 12px;
white-space: pre-wrap;
word-wrap: break-word;
margin-top: 10px;
}
.loading {
text-align: center;
padding: 20px;
display: none;
}
.loading.show {
display: block;
}
.spinner {
border: 3px solid #f3f3f3;
border-top: 3px solid #24292e;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.link {
color: #0366d6;
text-decoration: none;
font-weight: 600;
}
.link:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="container">
<h1>🐙 GitHub OAuth Test</h1>
<p class="subtitle">Django REST API - GitHub Authentication</p>
<div class="info-box">
<h3>📝 GitHub Personal Access Token Nasıl Alınır?</h3>
<ol>
<li><a href="https://github.com/settings/tokens" target="_blank" class="link">GitHub Settings → Tokens</a> sayfasına git</li>
<li><strong>Generate new token (classic)</strong> butonuna tıkla</li>
<li>Scopes seç:
<ul>
<li><code>user</code></li>
<li><code>user:email</code></li>
</ul>
</li>
<li>Token'ı oluştur ve kopyala</li>
<li>Aşağıdaki alana yapıştır</li>
</ol>
</div>
<div class="input-group">
<label for="githubToken">GitHub Personal Access Token:</label>
<input
type="text"
id="githubToken"
placeholder="ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
autocomplete="off"
/>
</div>
<button class="btn btn-github" onclick="testGitHubAuth()" id="testBtn">
<span></span>
Test GitHub Authentication
</button>
<div class="loading" id="loading">
<div class="spinner"></div>
<p style="margin-top: 10px; color: #24292e;">Testing authentication...</p>
</div>
<div class="result" id="result">
<h3 id="resultTitle">Result</h3>
<div id="resultContent"></div>
</div>
</div>
<script>
const API_BASE = 'http://localhost:8000/api/v1';
async function testGitHubAuth() {
const token = document.getElementById('githubToken').value.trim();
if (!token) {
showResult('error', 'Error ❌', {
error: 'Please enter a GitHub Personal Access Token'
});
return;
}
showLoading();
try {
const response = await fetch(`${API_BASE}/auth/social/github/`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
access_token: token
})
});
const data = await response.json();
hideLoading();
if (response.ok) {
showResult('success', 'GitHub Authentication Successful! ✅', data);
} else {
showResult('error', 'Authentication Failed ❌', data);
}
} catch (error) {
hideLoading();
showResult('error', 'Error ❌', {
error: error.message,
details: 'Make sure Django server is running on localhost:8000'
});
}
}
function showLoading() {
document.getElementById('loading').classList.add('show');
document.getElementById('result').classList.remove('show');
document.getElementById('testBtn').disabled = true;
}
function hideLoading() {
document.getElementById('loading').classList.remove('show');
document.getElementById('testBtn').disabled = false;
}
function showResult(type, title, data) {
const resultDiv = document.getElementById('result');
const resultTitle = document.getElementById('resultTitle');
const resultContent = document.getElementById('resultContent');
resultDiv.className = `result show ${type}`;
resultTitle.textContent = title;
if (type === 'success' && data.user) {
resultContent.innerHTML = `
<p><strong>🎉 Başarılı! Kullanıcı bilgileri:</strong></p>
<p><strong>Email:</strong> ${data.user.email}</p>
<p><strong>Name:</strong> ${data.user.first_name} ${data.user.last_name}</p>
<p><strong>ID:</strong> ${data.user.id}</p>
<p><strong>Active:</strong> ${data.user.is_active}</p>
<br>
<p><strong>JWT Tokens:</strong></p>
<div class="json-output">${JSON.stringify(data, null, 2)}</div>
`;
} else {
resultContent.innerHTML = `
<div class="json-output">${JSON.stringify(data, null, 2)}</div>
`;
}
}
// Enter key to submit
document.getElementById('githubToken').addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
testGitHubAuth();
}
});
</script>
</body>
</html>