fierj
PublicTiny personal git forge
51128dfc1f19d72b26b668448037806a19d063d6
diff --git a/auth.go b/auth.go
index a4bcf2a..bdc43d0 100644
--- a/auth.go
+++ b/auth.go
@@ -127,16 +127,6 @@ func (u UserStore) SetSSHKeys(username string, keys []string) error {
return nil
}
-// HasAnyKeys returns true if any user has SSH keys configured.
-func (u UserStore) HasAnyKeys() bool {
- for _, info := range u {
- if len(info.SSHKeys) > 0 {
- return true
- }
- }
- return false
-}
-
// FindUserByKey returns the username whose SSH keys contain the given key.
func (u UserStore) FindUserByKey(pubkeyFields []string) string {
for username, info := range u {
diff --git a/ssh.go b/ssh.go
index 1f91587..8692e9a 100644
--- a/ssh.go
+++ b/ssh.go
@@ -202,11 +202,9 @@ func (s *SSHServer) checkPushAuth(repoPath string, perms *ssh.Permissions) bool
// Check per-repo authorized_keys.
data, err := os.ReadFile(filepath.Join(repoPath, ".fierj.json"))
- var repoKeys int
if err == nil {
var meta RepoMeta
if err := json.Unmarshal(data, &meta); err == nil && len(meta.AuthorizedKeys) > 0 {
- repoKeys = len(meta.AuthorizedKeys)
for _, k := range meta.AuthorizedKeys {
kFields := strings.Fields(strings.TrimSpace(k))
if len(kFields) >= 2 && pubFields[0] == kFields[0] && pubFields[1] == kFields[1] {
@@ -221,11 +219,6 @@ func (s *SSHServer) checkPushAuth(repoPath string, perms *ssh.Permissions) bool
return true
}
- // If no authorization is configured anywhere, allow (backward compat).
- if repoKeys == 0 && !s.users.HasAnyKeys() {
- return true
- }
-
slog.Warn("ssh push rejected", "repo", filepath.Base(repoPath))
return false
}
diff --git a/templates/auth_setup.html b/templates/auth_setup.html
index 84e9e37..8a7a1e1 100644
--- a/templates/auth_setup.html
+++ b/templates/auth_setup.html
@@ -27,9 +27,9 @@
<input type="password" id="confirm" name="confirm" required minlength="6">
</div>
<div class="form-group">
- <label for="ssh_key">SSH public key (optional — enables git push)</label>
+ <label for="ssh_key">SSH public key (recommended)</label>
<textarea id="ssh_key" name="ssh_key" rows="3" placeholder="ssh-ed25519 AAAAC3..."></textarea>
- <span class="field-hint">Paste your public key to push via SSH without per-repo setup.</span>
+ <span class="field-hint">Required for git push. You can add it later on the Users page.</span>
</div>
<button type="submit" class="btn">Create account</button>
</form>
diff --git a/templates/base.html b/templates/base.html
index 20c1d72..b5531cd 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -215,10 +215,6 @@
background: rgba(255, 255, 255, 0.1);
}
- .topbar .nav-link-muted {
- opacity: 0.7;
- }
-
.topbar .nav-form {
display: inline;
}
@@ -1152,8 +1148,7 @@
New
</a>
{{if .User}}
- <a class="nav-link" href="/users">Users</a>
- <span class="nav-link nav-link-muted">{{.User}}</span>
+ <a class="nav-link" href="/users">{{.User}}</a>
<form method="post" action="/logout" class="nav-form">
<button type="submit" class="nav-link">Sign out</button>
</form>