fix lokinet name validations
This commit is contained in:
parent
4c8206701e
commit
5c312789ad
|
@ -26,6 +26,5 @@ module.exports = {
|
|||
// allow debugger during development
|
||||
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
|
||||
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
|
||||
// "vue/component-name-in-template-casing": ["error", "PascalCase"]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -2,11 +2,7 @@
|
|||
<div class="lns-input-form">
|
||||
<!-- Type -->
|
||||
<div class="col q-mt-sm">
|
||||
<LokiField
|
||||
:label="$t('fieldLabels.lnsType')"
|
||||
:disable="updating"
|
||||
:error="$v.record.name.$error"
|
||||
>
|
||||
<LokiField :label="$t('fieldLabels.lnsType')" :disable="updating">
|
||||
<q-select
|
||||
v-model.trim="record.type"
|
||||
emit-value
|
||||
|
@ -341,6 +337,7 @@ export default {
|
|||
if (this.record.type === "session") {
|
||||
return session_id(value);
|
||||
} else {
|
||||
// full lokinet address
|
||||
return lokinet_address(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -180,12 +180,7 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
// ENSURE THIS IS CORRECT, I THINK IT'S WRONG ATM
|
||||
validations: {
|
||||
// name: function(value) {
|
||||
// // TODO: validate on both session id and lokinet addresses
|
||||
// session_id(value) || lokinet_name(value);
|
||||
// }
|
||||
name: {
|
||||
session_id_or_lokinet_name
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ export const session_id = input => {
|
|||
|
||||
// shortened Lokinet LNS name
|
||||
export const lokinet_name = input => {
|
||||
console.log("lokinet name called");
|
||||
let inputSafe = input || "";
|
||||
console.log(inputSafe);
|
||||
// 63 including or excluding .loki??
|
||||
// const maxLen = inputSafe.contains("-") ? 32 : 63;
|
||||
// console.log("max len is: " + maxLen);
|
||||
return true;
|
||||
|
||||
let reservedNames = ["localhost", "loki", "snode"];
|
||||
return (
|
||||
!reservedNames.includes(inputSafe) &&
|
||||
/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(inputSafe)
|
||||
);
|
||||
};
|
||||
|
||||
export const session_id_or_lokinet_name = input => {
|
||||
|
@ -41,8 +41,6 @@ export const session_id_or_lokinet_name = input => {
|
|||
|
||||
// Full lokinet address
|
||||
export const lokinet_address = input => {
|
||||
console.log("lokinet address input");
|
||||
console.log(input);
|
||||
return (
|
||||
input.length === 52 &&
|
||||
/^[ybndrfg8ejkmcpqxot1uwisza345h769]{51}[yo]$/.test(input)
|
||||
|
|
Loading…
Reference in New Issue