fix authentication error code to 401

This commit is contained in:
nek0 2019-09-11 13:54:18 +02:00
parent b7c4215e27
commit 9a22594351
5 changed files with 16 additions and 16 deletions

View file

@ -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"
}

View file

@ -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."
}

View file

@ -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"
}

View file

@ -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."
}

View file

@ -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."
}