fix authentication error code to 401
This commit is contained in:
parent
b7c4215e27
commit
9a22594351
5 changed files with 16 additions and 16 deletions
|
@ -21,10 +21,10 @@ authLogout (Just muid) luid = do
|
||||||
then
|
then
|
||||||
processLogout luid
|
processLogout luid
|
||||||
else
|
else
|
||||||
throwError $ err403
|
throwError $ err401
|
||||||
{ errBody = "Forbidden"
|
{ errBody = "Unauthorized access"
|
||||||
}
|
}
|
||||||
authLogout Nothing _ = do
|
authLogout Nothing _ = do
|
||||||
throwError $ err403
|
throwError $ err401
|
||||||
{ errBody = "Forbidden"
|
{ errBody = "Unauthorized access"
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ avatarInsert (Just _) ad = do
|
||||||
conn <- rsConnection <$> ask
|
conn <- rsConnection <$> ask
|
||||||
insertAvatar ad conn
|
insertAvatar ad conn
|
||||||
avatarInsert Nothing _ =
|
avatarInsert Nothing _ =
|
||||||
throwError $ err403
|
throwError $ err401
|
||||||
{ errBody = "No Authentication present."
|
{ errBody = "No Authentication present."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ avatarUpdate (Just _) aid ad = do
|
||||||
conn <- rsConnection <$> ask
|
conn <- rsConnection <$> ask
|
||||||
void $ updateAvatar aid ad conn
|
void $ updateAvatar aid ad conn
|
||||||
avatarUpdate Nothing _ _ = do
|
avatarUpdate Nothing _ _ = do
|
||||||
throwError $ err403
|
throwError $ err401
|
||||||
{ errBody = "No Authentication present."
|
{ errBody = "No Authentication present."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,6 @@ journalShow (Just _) mlimit moffset = do
|
||||||
conn <- rsConnection <$> ask
|
conn <- rsConnection <$> ask
|
||||||
selectJournalEntries mlimit moffset conn
|
selectJournalEntries mlimit moffset conn
|
||||||
journalShow Nothing _ _ =
|
journalShow Nothing _ _ =
|
||||||
throwError $ err403
|
throwError $ err401
|
||||||
{ errBody = "No Authentication present"
|
{ errBody = "No Authentication present"
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ productNew (Just _) bevsub = do
|
||||||
void $ insertNewEmptyAmount bevid bevsub conn
|
void $ insertNewEmptyAmount bevid bevsub conn
|
||||||
return bevid
|
return bevid
|
||||||
productNew Nothing _ =
|
productNew Nothing _ =
|
||||||
throwError $ err403
|
throwError $ err401
|
||||||
|
|
||||||
productOverview :: Int -> MateHandler ProductOverview
|
productOverview :: Int -> MateHandler ProductOverview
|
||||||
productOverview pid = do
|
productOverview pid = do
|
||||||
|
@ -39,7 +39,7 @@ productStockRefill (Just _) amorefs = do
|
||||||
{ errBody = "Amounts less than 0 are not acceptable."
|
{ errBody = "Amounts less than 0 are not acceptable."
|
||||||
}
|
}
|
||||||
productStockRefill Nothing _ =
|
productStockRefill Nothing _ =
|
||||||
throwError $ err403
|
throwError $ err401
|
||||||
{ errBody = "No Authentication present."
|
{ errBody = "No Authentication present."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ productStockUpdate (Just _) amoups = do
|
||||||
{ errBody = "Amounts less than 0 are not acceptable."
|
{ errBody = "Amounts less than 0 are not acceptable."
|
||||||
}
|
}
|
||||||
productStockUpdate Nothing _ =
|
productStockUpdate Nothing _ =
|
||||||
throwError $ err403
|
throwError $ err401
|
||||||
{ errBody = "No Authentication present."
|
{ errBody = "No Authentication present."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ userNew us = do
|
||||||
|
|
||||||
userGet :: Maybe Int -> Int -> MateHandler UserDetails
|
userGet :: Maybe Int -> Int -> MateHandler UserDetails
|
||||||
userGet Nothing _ =
|
userGet Nothing _ =
|
||||||
throwError $ err403
|
throwError $ err401
|
||||||
{ errBody = "No Authentication present."
|
{ errBody = "No Authentication present."
|
||||||
}
|
}
|
||||||
userGet (Just aid) uid =
|
userGet (Just aid) uid =
|
||||||
|
@ -40,13 +40,13 @@ userGet (Just aid) uid =
|
||||||
conn <- rsConnection <$> ask
|
conn <- rsConnection <$> ask
|
||||||
userDetailsSelect uid conn
|
userDetailsSelect uid conn
|
||||||
else
|
else
|
||||||
throwError $ err403
|
throwError $ err401
|
||||||
{ errBody = "Wrong Authentication present."
|
{ errBody = "Wrong Authentication present."
|
||||||
}
|
}
|
||||||
|
|
||||||
userUpdate :: Maybe Int -> Int -> UserDetailsSubmit -> MateHandler ()
|
userUpdate :: Maybe Int -> Int -> UserDetailsSubmit -> MateHandler ()
|
||||||
userUpdate Nothing _ _ =
|
userUpdate Nothing _ _ =
|
||||||
throwError $ err403
|
throwError $ err401
|
||||||
{ errBody = "No Authentication present."
|
{ errBody = "No Authentication present."
|
||||||
}
|
}
|
||||||
userUpdate (Just aid) uid uds =
|
userUpdate (Just aid) uid uds =
|
||||||
|
@ -56,7 +56,7 @@ userUpdate (Just aid) uid uds =
|
||||||
conn <- rsConnection <$> ask
|
conn <- rsConnection <$> ask
|
||||||
void $ updateUserDetails uid uds (utctDay now) conn
|
void $ updateUserDetails uid uds (utctDay now) conn
|
||||||
else
|
else
|
||||||
throwError $ err403
|
throwError $ err401
|
||||||
{ errBody = "Wrong Authentication present."
|
{ errBody = "Wrong Authentication present."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ userRecharge (Just auid) (UserRecharge amount) =
|
||||||
{ errBody = "Amounts less or equal zero are not acceptable."
|
{ errBody = "Amounts less or equal zero are not acceptable."
|
||||||
}
|
}
|
||||||
userRecharge Nothing _ =
|
userRecharge Nothing _ =
|
||||||
throwError $ err403
|
throwError $ err401
|
||||||
{ errBody = "No Authentication present."
|
{ errBody = "No Authentication present."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,6 +120,6 @@ userTransfer (Just auid) (UserTransfer target amount) =
|
||||||
{ errBody = "Amounts less or equal zero are not acceptable."
|
{ errBody = "Amounts less or equal zero are not acceptable."
|
||||||
}
|
}
|
||||||
userTransfer Nothing _ =
|
userTransfer Nothing _ =
|
||||||
throwError $ err403
|
throwError $ err401
|
||||||
{ errBody = "No Authentication present."
|
{ errBody = "No Authentication present."
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue