1apollo.service('Validity', function() { 2 var service = {}; 3 service.tests = { 4 email:/^[^\s@]+@[^\s@]+\.[^\s@]+$/, 5 name: /^[a-zA-Z ]{1,40}$/, 6 pass: /^[a-zA-Z0-9!@#`~%^&_-]{8,24}$/ 7 } 8 9 service.error = { 10 insufficientData:"Please fill out all jawns.", 11 weirdEmail:"Please give a valid email address.", 12 weirdPass:"Please give an acceptable password.", 13 weirdName:"Please give an actual, normal name.", 14 noUser:"No user associated with that email address could be found.", 15 mismatch:"Please enter matching passwords.", 16 badEmail:"Invalid email/password combination entered.", 17 badPass:"Invalid email/password combination entered.", 18 lockedOut:"Maximum number of access attempts reached. Wait 10 minutes and try again.", 19 taken:"That email address has been used already.", 20 badDomain:"Please register using an Aspire email address.", 21 unwarranted:"Invalid request attempted.", 22 notWhitelisted:"Registration is currently only open to whitelisted employees.", 23 notActivated:"Your account has not yet been activated. If you haven't received a valid activation email, reactivate below.", 24 alreadyActivated:"Your account is already activated.", 25 activationSuccess:"Your account has been successfully activated.", 26 activationMaybeSent:"If there is an account associated with the email you entered, we've sent a new activation code to it.", 27 resetMaybeSent:"If there is an account associated with the email you entered, we've sent it a link to reset your password.", 28 badEmail:"Invalid email address provided.", 29 badToken:"Invalid activation token provided.", 30 registerSuccess:"Registered! Click the link in your email to activate, so you can log in and stuff.", 31 noToken:"No activation token provided.", 32 couldntWrite:"Couldn't save email address. Try again later!", 33 duplicate:"The email address you entered has already been registered.", 34 changePassSuccess:"Password successfully changed.", 35 unknown:"An unknown error occurred." 36 } 37 38 39 service.check = function (mode, input, confirm) { 40 if (!mode || !input || input.length === 0) { 41 return null; 42 } else if (mode !== "confirm") { 43 return (service.tests[mode].test(input)); 44 } else { 45 return (service.tests['pass'].test(input) && input === confirm); 46 } 47 } 48 49 service.feedback = function (mode, input, confirm) { 50 if (!mode || !input || input.length === 0) { 51 return null; 52 } 53 switch (mode) { 54 case "email": 55 return (service.check(mode, input) ? "" : service.error.weirdEmail); 56 break; 57 case "name": 58 return (service.check(mode, input) ? "" : service.error.weirdName); 59 break; 60 case "pass": 61 return (service.check(mode, input) ? "" : service.error.weirdPass); 62 break; 63 case "confirm": 64 return (service.check(mode, input, confirm) ? "" : (service.check('pass',input) ? service.error.mismatch : service.error.weirdPass)); 65 break; 66 } 67 } 68 69 return service; 70});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.