FossilRepo

fossilrepo / templates / accounts / profile_token_create.html
Source Blame History 76 lines
c588255… ragelink 1 {% extends "base.html" %}
c588255… ragelink 2 {% block title %}Generate Token — Fossilrepo{% endblock %}
c588255… ragelink 3
c588255… ragelink 4 {% block content %}
c588255… ragelink 5 <div class="max-w-2xl">
c588255… ragelink 6 <div class="flex items-center gap-3 mb-6">
c588255… ragelink 7 <a href="{% url 'accounts:profile' %}" class="text-gray-400 hover:text-white">
c588255… ragelink 8 <svg class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
c588255… ragelink 9 <path stroke-linecap="round" stroke-linejoin="round" d="M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18" />
c588255… ragelink 10 </svg>
c588255… ragelink 11 </a>
c588255… ragelink 12 <h1 class="text-2xl font-bold text-gray-100">Generate Personal Access Token</h1>
c588255… ragelink 13 </div>
c588255… ragelink 14
c588255… ragelink 15 <form method="post" class="space-y-6">
c588255… ragelink 16 {% csrf_token %}
c588255… ragelink 17
c588255… ragelink 18 <div class="rounded-lg bg-gray-800 border border-gray-700 p-6 space-y-4">
c588255… ragelink 19 <div>
c588255… ragelink 20 <label for="name" class="block text-sm font-medium text-gray-300 mb-1">Token Name</label>
c588255… ragelink 21 <input type="text" name="name" id="name" required maxlength="200"
c588255… ragelink 22 placeholder="e.g. CI/CD pipeline, CLI access"
c588255… ragelink 23 class="w-full rounded-md border-gray-600 bg-gray-900 text-gray-100 text-sm px-3 py-2 focus:border-brand focus:ring-brand">
c588255… ragelink 24 <p class="mt-1 text-xs text-gray-500">A descriptive name to remember what this token is for.</p>
c588255… ragelink 25 </div>
c588255… ragelink 26
c588255… ragelink 27 <div>
c588255… ragelink 28 <label class="block text-sm font-medium text-gray-300 mb-2">Scopes</label>
c588255… ragelink 29 <div class="space-y-2">
c588255… ragelink 30 <label class="flex items-center gap-3 cursor-pointer">
c588255… ragelink 31 <input type="checkbox" name="scope_read" checked disabled
c588255… ragelink 32 class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand">
c588255… ragelink 33 <div>
c588255… ragelink 34 <span class="text-sm font-medium text-gray-200">read</span>
c588255… ragelink 35 <span class="text-xs text-gray-500 ml-2">Read access to repositories and data (always included)</span>
c588255… ragelink 36 </div>
c588255… ragelink 37 </label>
c588255… ragelink 38 <label class="flex items-center gap-3 cursor-pointer">
c588255… ragelink 39 <input type="checkbox" name="scope_write" value="write"
c588255… ragelink 40 class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand">
c588255… ragelink 41 <div>
c588255… ragelink 42 <span class="text-sm font-medium text-gray-200">write</span>
c588255… ragelink 43 <span class="text-xs text-gray-500 ml-2">Push changes, create/update tickets and wiki</span>
c588255… ragelink 44 </div>
c588255… ragelink 45 </label>
c588255… ragelink 46 <label class="flex items-center gap-3 cursor-pointer">
c588255… ragelink 47 <input type="checkbox" name="scope_admin" value="admin"
c588255… ragelink 48 class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand">
c588255… ragelink 49 <div>
c588255… ragelink 50 <span class="text-sm font-medium text-gray-200">admin</span>
c588255… ragelink 51 <span class="text-xs text-gray-500 ml-2">Full administrative access</span>
c588255… ragelink 52 </div>
c588255… ragelink 53 </label>
c588255… ragelink 54 </div>
c588255… ragelink 55 <input type="hidden" name="scopes" id="scopes_hidden" value="read">
c588255… ragelink 56 </div>
c588255… ragelink 57 </div>
c588255… ragelink 58
c588255… ragelink 59 <div class="flex items-center gap-3">
c588255… ragelink 60 <button type="submit" onclick="buildScopes()" class="rounded-md bg-brand px-4 py-2 text-sm font-semibold text-white hover:bg-brand-hover">
c588255… ragelink 61 Generate Token
c588255… ragelink 62 </button>
c588255… ragelink 63 <a href="{% url 'accounts:profile' %}" class="text-sm text-gray-400 hover:text-white">Cancel</a>
c588255… ragelink 64 </div>
c588255… ragelink 65 </form>
c588255… ragelink 66 </div>
c588255… ragelink 67
c588255… ragelink 68 <script>
c588255… ragelink 69 function buildScopes() {
c588255… ragelink 70 var scopes = ['read'];
c588255… ragelink 71 if (document.querySelector('input[name="scope_write"]').checked) scopes.push('write');
c588255… ragelink 72 if (document.querySelector('input[name="scope_admin"]').checked) scopes.push('admin');
c588255… ragelink 73 document.getElementById('scopes_hidden').value = scopes.join(',');
c588255… ragelink 74 }
c588255… ragelink 75 </script>
c588255… ragelink 76 {% endblock %}

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button