diff --git a/src/Control/Auth.hs b/src/Control/Auth.hs index ef0327e..7b03d19 100644 --- a/src/Control/Auth.hs +++ b/src/Control/Auth.hs @@ -21,10 +21,10 @@ authLogout (Just muid) luid = do then processLogout luid else - throwError $ err403 - { errBody = "Forbidden" + throwError $ err401 + { errBody = "Unauthorized access" } authLogout Nothing _ = do - throwError $ err403 - { errBody = "Forbidden" + throwError $ err401 + { errBody = "Unauthorized access" } diff --git a/src/Control/Avatar.hs b/src/Control/Avatar.hs index b443403..ecfa05c 100644 --- a/src/Control/Avatar.hs +++ b/src/Control/Avatar.hs @@ -50,7 +50,7 @@ avatarInsert (Just _) ad = do conn <- rsConnection <$> ask insertAvatar ad conn avatarInsert Nothing _ = - throwError $ err403 + throwError $ err401 { errBody = "No Authentication present." } @@ -63,7 +63,7 @@ avatarUpdate (Just _) aid ad = do conn <- rsConnection <$> ask void $ updateAvatar aid ad conn avatarUpdate Nothing _ _ = do - throwError $ err403 + throwError $ err401 { errBody = "No Authentication present." } diff --git a/src/Control/Journal.hs b/src/Control/Journal.hs index 72ee286..31cd2b6 100644 --- a/src/Control/Journal.hs +++ b/src/Control/Journal.hs @@ -19,6 +19,6 @@ journalShow (Just _) mlimit moffset = do conn <- rsConnection <$> ask selectJournalEntries mlimit moffset conn journalShow Nothing _ _ = - throwError $ err403 + throwError $ err401 { errBody = "No Authentication present" } diff --git a/src/Control/Product.hs b/src/Control/Product.hs index f3806d8..c92043b 100644 --- a/src/Control/Product.hs +++ b/src/Control/Product.hs @@ -21,7 +21,7 @@ productNew (Just _) bevsub = do void $ insertNewEmptyAmount bevid bevsub conn return bevid productNew Nothing _ = - throwError $ err403 + throwError $ err401 productOverview :: Int -> MateHandler ProductOverview productOverview pid = do @@ -39,7 +39,7 @@ productStockRefill (Just _) amorefs = do { errBody = "Amounts less than 0 are not acceptable." } productStockRefill Nothing _ = - throwError $ err403 + throwError $ err401 { errBody = "No Authentication present." } @@ -54,7 +54,7 @@ productStockUpdate (Just _) amoups = do { errBody = "Amounts less than 0 are not acceptable." } productStockUpdate Nothing _ = - throwError $ err403 + throwError $ err401 { errBody = "No Authentication present." } diff --git a/src/Control/User.hs b/src/Control/User.hs index 0bf3848..751b4cd 100644 --- a/src/Control/User.hs +++ b/src/Control/User.hs @@ -31,7 +31,7 @@ userNew us = do userGet :: Maybe Int -> Int -> MateHandler UserDetails userGet Nothing _ = - throwError $ err403 + throwError $ err401 { errBody = "No Authentication present." } userGet (Just aid) uid = @@ -40,13 +40,13 @@ userGet (Just aid) uid = conn <- rsConnection <$> ask userDetailsSelect uid conn else - throwError $ err403 + throwError $ err401 { errBody = "Wrong Authentication present." } userUpdate :: Maybe Int -> Int -> UserDetailsSubmit -> MateHandler () userUpdate Nothing _ _ = - throwError $ err403 + throwError $ err401 { errBody = "No Authentication present." } userUpdate (Just aid) uid uds = @@ -56,7 +56,7 @@ userUpdate (Just aid) uid uds = conn <- rsConnection <$> ask void $ updateUserDetails uid uds (utctDay now) conn else - throwError $ err403 + throwError $ err401 { errBody = "Wrong Authentication present." } @@ -84,7 +84,7 @@ userRecharge (Just auid) (UserRecharge amount) = { errBody = "Amounts less or equal zero are not acceptable." } userRecharge Nothing _ = - throwError $ err403 + throwError $ err401 { errBody = "No Authentication present." } @@ -120,6 +120,6 @@ userTransfer (Just auid) (UserTransfer target amount) = { errBody = "Amounts less or equal zero are not acceptable." } userTransfer Nothing _ = - throwError $ err403 + throwError $ err401 { errBody = "No Authentication present." }