Merge pull request #198 from shocknet/bug/auth_issues

More descriptive error messages
This commit is contained in:
CapDog 2020-09-15 17:48:05 -05:00 committed by GitHub
commit 3f5ca53c0d

View file

@ -570,6 +570,10 @@ module.exports = async (
const walletUnlocked = health.LNDStatus.walletStatus === 'unlocked' const walletUnlocked = health.LNDStatus.walletStatus === 'unlocked'
const { authorization = '' } = req.headers const { authorization = '' } = req.headers
if (!isKeyTrusted) {
logger.warn('Untrusted public key!')
}
if (!walletUnlocked) { if (!walletUnlocked) {
await unlockWallet(password) await unlockWallet(password)
} }
@ -577,7 +581,8 @@ module.exports = async (
if (walletUnlocked && !authorization && !isKeyTrusted) { if (walletUnlocked && !authorization && !isKeyTrusted) {
res.status(401).json({ res.status(401).json({
field: 'alias', field: 'alias',
errorMessage: 'Invalid alias/password combination', errorMessage:
'Invalid alias/password combination (Untrusted Device)',
success: false success: false
}) })
return return
@ -591,7 +596,8 @@ module.exports = async (
if (!validatedToken) { if (!validatedToken) {
res.status(401).json({ res.status(401).json({
field: 'alias', field: 'alias',
errorMessage: 'Invalid alias/password combination', errorMessage:
'Invalid alias/password combination (Untrusted Auth Token)',
success: false success: false
}) })
return return