diff --git a/contract/passtorage.go b/contract/passtorage.go index e2c6aae..13f921d 100644 --- a/contract/passtorage.go +++ b/contract/passtorage.go @@ -7,8 +7,12 @@ import ( func CreateUser(login string, password interop.Hash256) { ctx := storage.GetContext() - // NOTE: maybe we should handle case where user already exists - storage.Put(ctx, login, password) + storedValue := storage.Get(ctx, login).(interop.Hash256) + if storedValue != nil { + panic("This user already exists") + } else { + storage.Put(ctx, login, password) + } } func CheckUser(login string, givenPassword interop.Hash256) {