Added email and gravatar to user config

This commit is contained in:
Thomas Miceli
2023-03-19 16:29:14 +01:00
parent 858ee3e70a
commit 7b27db8849
6 changed files with 107 additions and 23 deletions

View File

@ -58,7 +58,7 @@
{{ if .userLogged.IsAdmin }}
<a href="/admin" class="hidden sm:block text-slate-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium" aria-current="page">Admin</a>
{{ end }}
<a href="/ssh-keys" class="hidden sm:block text-slate-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium" aria-current="page">SSH Keys</a>
<a href="/settings" class="hidden sm:block text-slate-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium" aria-current="page">Config</a>
<a href="/logout" id="logged-button" class="inline-flex text-slate-300 hover:bg-rose-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">
<p class="text-slate-300 mr-1 username">{{ .userLogged.Username }}</p>
@ -90,7 +90,7 @@
<a href="/all" class="bg-gray-900 text-white block px-3 py-2 rounded-md text-base font-medium" aria-current="page">All</a>
{{ if .userLogged }}
<a href="/{{ .userLogged.Username }}" class="text-slate-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium">My gists</a>
<a href="/ssh-keys" class="text-slate-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium">SSH Keys</a>
<a href="/settings" class="text-slate-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium">Config</a>
{{ if .userLogged.IsAdmin }}
<a href="/admin" class="text-slate-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium">Admin</a>

View File

@ -2,19 +2,54 @@
<div class="py-10">
<header class="pb-4">
<div>
<h1 class="text-2xl font-bold leading-tight">SSH Keys</h1>
<p class="text-sm text-gray-400 italic">Used only to push gists using Git via SSH</p>
<h1 class="text-2xl font-bold leading-tight">Settings</h1>
</div>
</header>
<main>
<div >
<div class="space-y-4">
<div class="sm:grid grid-cols-2 gap-x-4 md:gap-x-16">
<div class="w-full">
<div class="bg-gray-900 rounded-md border border-1 border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10">
<h2 class="text-md font-bold text-slate-300 mb-4">
<h2 class="text-md font-bold text-slate-300">
Email
</h2>
<h3 class="text-sm text-gray-400 italic mb-4">
Used for commits and Gravatar
</h3>
<form class="space-y-6" action="/settings/email" method="post">
<div>
<div class="mt-1">
<input id="email" name="email" value="{{ .userLogged.Email }}" type="email" required autocomplete="off" class="bg-gray-800 appearance-none block w-full px-3 py-2 border border-gray-700 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
</div>
</div>
<button type="submit" class="inline-flex items-center px-4 py-2 border border-transparent border-gray-700 text-sm font-medium rounded-md shadow-sm text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">Set email</button>
{{ .csrfHtml }}
</form>
</div>
</div>
<div class="w-full">
<div class="bg-gray-900 rounded-md border border-1 border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10">
<h2 class="text-md font-bold text-slate-300">
Delete account
</h2>
<form class="space-y-6" action="/settings/account" method="post" onsubmit="return confirm('Are you sure you want to delete your account ?')">
<input type="hidden" name="_method" value="DELETE">
<button type="submit" class="inline-flex items-center px-4 py-2 border border-transparent border-gray-700 text-sm font-medium rounded-md shadow-sm text-white bg-rose-600 hover:bg-rose-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 mt-2">Delete account</button>
{{ .csrfHtml }}
</form>
</div>
</div>
</div>
<div class="sm:grid grid-cols-2 gap-x-4 md:gap-x-16">
<div class="w-full">
<div class="bg-gray-900 rounded-md border border-1 border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10">
<h2 class="text-md font-bold text-slate-300">
Add SSH Key
</h2>
<form class="space-y-6" action="#" method="post">
<h3 class="text-sm text-gray-400 italic mb-4">
Used only to push gists using Git via SSH
</h3>
<form class="space-y-6" action="/settings/ssh-keys" method="post">
<div>
<label for="title" class="block text-sm font-medium text-slate-300"> Title </label>
<div class="mt-1">
@ -53,7 +88,7 @@
<p class="text-xs text-gray-500 line-clamp-2">Last used <span class="moment-timestamp">{{ .LastUsedAt }}</span></p>
{{ end }}
</div>
<form action="/ssh-keys/{{.ID}}" method="post" class="inline-block" onsubmit="return confirm('Confirm deletion of SSH key')">
<form action="/settings/ssh-keys/{{.ID}}" method="post" class="inline-block" onsubmit="return confirm('Confirm deletion of SSH key')">
<input type="hidden" name="_method" value="DELETE">
{{ $.csrfHtml }}