From 846ac3f6c40dbf4e8fe3c0bf37af15299881a2b2 Mon Sep 17 00:00:00 2001 From: evan Date: Thu, 29 Oct 2015 14:20:38 -0700 Subject: [PATCH] Return error when attempting to delegate to non-existant user to UI and API --- core/core.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/core.go b/core/core.go index a645c22..695bc60 100644 --- a/core/core.go +++ b/core/core.go @@ -316,6 +316,13 @@ func Delegate(jsonIn []byte) ([]byte, error) { return jsonStatusError(err) } + // Make sure the user we are delegating to exists + for _, user := range s.Users { + if _, ok := records.GetRecord(user); !ok { + err = errors.New("User not present") + return jsonStatusError(err) + } + } // Find password record for user and verify that their password // matches. If not found then add a new entry for this user.