mirror of
https://github.com/fiatjaf/khatru.git
synced 2025-09-17 16:53:32 +02:00
only reset ws.Authed if it's nil.
i.e. if there has been an auth and for some reason the client tried to auth again after RequestAuth() has been called again.
This commit is contained in:
4
utils.go
4
utils.go
@@ -15,7 +15,9 @@ const (
|
|||||||
func RequestAuth(ctx context.Context) {
|
func RequestAuth(ctx context.Context) {
|
||||||
ws := GetConnection(ctx)
|
ws := GetConnection(ctx)
|
||||||
ws.authLock.Lock()
|
ws.authLock.Lock()
|
||||||
ws.Authed = make(chan struct{})
|
if ws.Authed == nil {
|
||||||
|
ws.Authed = make(chan struct{})
|
||||||
|
}
|
||||||
ws.authLock.Unlock()
|
ws.authLock.Unlock()
|
||||||
ws.WriteJSON(nostr.AuthEnvelope{Challenge: &ws.Challenge})
|
ws.WriteJSON(nostr.AuthEnvelope{Challenge: &ws.Challenge})
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user