Emberveil source

mobile/public/login.js

export function validateLogin(username,password){
 const name=String(username).normalize('NFKC').replace(/[\u200B-\u200D\uFEFF]/g,'').trim();
 if(!/^[A-Za-z0-9 ]{1,12}$/.test(name))return {error:'Use a game username with 1–12 letters, numbers or spaces. Do not enter an email address.'};
 if(!String(password).trim())return {error:'Enter a password. New players choose their own password to create an account.'};
 if(String(password).length>20)return {error:'Game passwords must be 20 characters or fewer.'};
 return {name};
}
export function loginMessage(message){
 if(message.includes('Or you entered an invalid character'))return 'Login rejected. Use a game username with letters, numbers or spaces and enter a password. An email address will not work.';
 if(message.includes('Invalid username or password.'))return 'That username already exists and the password did not match. Use its existing password, or choose a different new username.';
 return message;
}