From d40a22b7f6c4c0426da168c4de0e573e94a8545d Mon Sep 17 00:00:00 2001
From: josh <josh@elixxir.io>
Date: Tue, 18 Feb 2020 14:44:04 -0800
Subject: [PATCH] Revert removed code

---
 notifications/notifications.go | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/notifications/notifications.go b/notifications/notifications.go
index 7cb3972..98b89cf 100644
--- a/notifications/notifications.go
+++ b/notifications/notifications.go
@@ -204,6 +204,10 @@ func pollForNotifications(nb *Impl) (strings []string, e error) {
 
 // RegisterForNotifications is called by the client, and adds a user registration to our database
 func (nb *Impl) RegisterForNotifications(clientToken []byte, auth *connect.Auth) error {
+	if !auth.IsAuthenticated {
+		return errors.New("Cannot register for notifications: client is not authenticated")
+	}
+
 	// Implement this
 	u := &storage.User{
 		Id:    auth.Sender.GetId(),
@@ -218,6 +222,10 @@ func (nb *Impl) RegisterForNotifications(clientToken []byte, auth *connect.Auth)
 
 // UnregisterForNotifications is called by the client, and removes a user registration from our database
 func (nb *Impl) UnregisterForNotifications(auth *connect.Auth) error {
+	if !auth.IsAuthenticated {
+		return errors.New("Cannot unregister for notifications: client is not authenticated")
+	}
+
 	err := nb.Storage.DeleteUser(auth.Sender.GetId())
 	if err != nil {
 		return errors.Wrap(err, "Failed to unregister user with notifications")
-- 
GitLab