external lightning address validator (#2056)
This commit is contained in:
parent
2d51a5def9
commit
88253e5478
@ -51,6 +51,12 @@ export const lightningAddressValidator = process.env.NODE_ENV === 'development'
|
||||
'address is no good')
|
||||
: string().email('address is no good')
|
||||
|
||||
export const externalLightningAddressValidator = lightningAddressValidator.test({
|
||||
name: 'address',
|
||||
test: addr => !addr.toLowerCase().endsWith('@stacker.news'),
|
||||
message: 'lightning address must be external'
|
||||
})
|
||||
|
||||
async function usernameExists (name, { client, models }) {
|
||||
if (!client && !models) {
|
||||
throw new Error('cannot check for user')
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { lightningAddressValidator } from '@/lib/validate'
|
||||
import { externalLightningAddressValidator } from '@/lib/validate'
|
||||
|
||||
export const name = 'lightning-address'
|
||||
export const shortName = 'lnAddr'
|
||||
@ -12,11 +12,7 @@ export const fields = [
|
||||
type: 'text',
|
||||
autoComplete: 'off',
|
||||
serverOnly: true,
|
||||
validate: lightningAddressValidator.test({
|
||||
name: 'address',
|
||||
test: addr => !addr.toLowerCase().endsWith('@stacker.news'),
|
||||
message: 'lightning address must be external'
|
||||
})
|
||||
validate: externalLightningAddressValidator
|
||||
}
|
||||
]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user