diff options
| author | wikiapiserver | 2026-06-25 14:40:16 +0200 |
|---|---|---|
| committer | wikiapiserver | 2026-06-25 14:40:16 +0200 |
| commit | e375b6cc68f4a9b0e91b25479538dc76d1f1e620 (patch) | |
| tree | 7cfd3c2f885a14b9a2017f738f9bbc833ae15a7b /api/handlers.go | |
| parent | 21fb3c12c86fe3f03531c4f323854da36fb82628 (diff) | |
| download | wikiapiserver-e375b6cc68f4a9b0e91b25479538dc76d1f1e620.tar.gz | |
refactor: extract Wikimedia auth into reusable function
- WikimediaLogin is a standalone function: POSTs to auth.enterprise.wikimedia.com
and returns the tokens. Can be called from any flow.
- Register composes WikimediaLogin + CreateAccount
- CreateAccount now takes tokens as arguments (pure DB insert)
Diffstat (limited to 'api/handlers.go')
| -rw-r--r-- | api/handlers.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/api/handlers.go b/api/handlers.go index 109eca3..7918b40 100644 --- a/api/handlers.go +++ b/api/handlers.go @@ -79,7 +79,7 @@ func (h *Handler) Register(w http.ResponseWriter, r *http.Request) { return } - acct, err := h.db.CreateAccount(ctx, req.Username, req.Password) + acct, err := h.db.Register(ctx, req.Username, req.Password) if err != nil { if err.Error() == "username already exists" { badRequest(w, "username already exists") |
