feat: change email, export my data, delete account (with data anonymization)

This commit is contained in:
Florian Sylvain committed 2026-10-30 20:19:07 +01:00
1 parent bb191c389a
commit 10a66cd979
123 files changed
+10789 -76

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
package author
import "strconv"
const DeletedName = "Deleted user"
const DeletedSlugPrefix = "deleted-user-"
func DeletedSlug(id uint32) string {
return DeletedSlugPrefix + strconv.FormatUint(uint64(id), 10)
}
func DeletedSlugAttempt(id uint32, attempt int) string {
if attempt <= 1 {
return DeletedSlug(id)
}
return DeletedSlug(id) + "-" + strconv.Itoa(attempt)
}
func IsReservedSlug(candidate string) bool {
return len(candidate) >= len(DeletedSlugPrefix) && candidate[:len(DeletedSlugPrefix)] == DeletedSlugPrefix
}
func avoidReserved(candidate string) string {
if IsReservedSlug(candidate) {
return FallbackSlug + "-" + candidate
}
return candidate
}
+3 -3
View File
@@ -112,7 +112,7 @@ type Page struct {
}
func IsValidSlug(candidate string) bool {
return slug.IsValid(candidate)
return slug.IsValid(candidate) && !IsReservedSlug(candidate)
}
func IsValidName(name string) bool {
@@ -172,9 +172,9 @@ func ValidateLinks(links []SocialLink) error {
}
func GenerateSlug(name string) string {
return slug.Generate(name, FallbackSlug)
return avoidReserved(slug.Generate(name, FallbackSlug))
}
func SlugWithSuffix(base string, attempt int) string {
return slug.WithSuffix(base, attempt)
return avoidReserved(slug.WithSuffix(base, attempt))
}