Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Fix recovery code validation with missing base64 padding char #1850

Merged
merged 1 commit into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/js/sign-in/views/_initial.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const validateInput = async value =>
return true
}
// Base64 encoded encrypted phrase
return /[a-zA-Z0-9+/]=$/.test(value)
return /[a-zA-Z0-9+/]=?$/.test(value)
})

const validationSchema = Yup.object({
Expand Down
4 changes: 2 additions & 2 deletions app/js/utils/encryption-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export function validateAndCleanRecoveryInput(input) {
let cleanedEncrypted = cleaned.replace(/\s/gm, '')

if (
cleanedEncrypted.length === 107 &&
cleanedEncrypted.indexOf('=') !== 106
/^[a-zA-Z0-9\+\/]+=?$/.test(cleanedEncrypted) &&
cleanedEncrypted.slice(-1) !== '='
) {
// Append possibly missing equals sign padding
logger.debug('Encrypted Phrase needs an `=` at the end.')
Expand Down