1export default { 2 template: '#register', 3 props: ['url'], 4 data() { 5 return { 6 step: 0, 7 user: { 8 fName: '', 9 lName: '', 10 affiliation: '', 11 title: '', 12 state: null, 13 flds: null, 14 oversight: false, 15 email: '', 16 phone: '', 17 passcode: '', 18 modules: [false,false,false,false,false,false,false,false,false], 19 }, 20 employer_type: 'private', 21 errors: [false,false,false,false,false,false,false,false,false], 22 passError: '', 23 all: false, 24 match: '', 25 } 26 }, 27 created() { 28 this.modules = emit.qry({ typ: 'find', coll: 'modules', q: { name: { '$ne' : null }} }); 29 this.agencies = [ 30 { label: 'Bureau of Land Management', value: 'BLM', ref: '@blm.gov' }, 31 { label: 'Forest Service', value: 'USFS', ref: '@usda.gov' }, 32 { label: 'Fish and Wildlife Service', value: 'FWS', ref: '@fws.gov' }, 33 { label: 'National Park Service', value: 'NPS', ref: '@nps.gov' }, 34 { label: 'Environmental Protection Agency', value: 'EPA', ref: '@epa.gov' }, 35 //{ label: 'Colorado Dept. of Public Health and Environment', value: 'CDPHE', ref: '@state.co.us' }, 36 ]; 37 this.states = ['Alaska','Arizona','California','Colorado','Eastern States','Idaho','Montana / Dakotas','Oregon / Washington','Nevada','New Mexico','Utah','Wyoming']; 38 this.fields = []; 39 }, 40 computed: { 41 role() { return (this.employer_type == 'government' && this.user.affiliation == 'BLM') ? 'internal': 'external' }, 42 }, 43 methods: { 44 checkAll() { 45 this.user.modules = (this.all == true) ? [true,true,true,true,true,true,true,true,true] : [false,false,false,false,false,false,false,false,false]; 46 }, 47 back() { if (this.step > 0) { this.step-- } }, 48 next() { 49 switch (this.step) { 50 case 1: 51 let flds = ['fName','lName','affiliation','title','email','phone']; 52 flds.forEach((fld, indx) => { 53 if (this.user[fld] == '' || this.user[fld] == null) { 54 this.errors.splice(indx, 1, true); 55 } else { this.errors.splice(indx, 1, false) } 56 }); 57 if (this.employer_type == 'government') { 58 let agency = this.agencies.filter(age => age.value == this.user.affiliation)[0]; 59 let eform = this.user.email.split('@'); 60 if (eform.length != 2 || agency.ref != `@${eform[1]}`) { 61 this.errors.splice(4, 1, true); 62 } else { this.errors.splice(4, 1, false) } 63 } 64 // dot checking email or regex!! 65 if (this.employer_type == 'government' && this.user.affiliation == 'BLM' && this.user.title != 'Air Resource Specialist') { 66 if (this.user.state == null) { 67 this.errors.splice(6, 1, true); 68 } else { this.errors.splice(6, 1, false) } 69 if (this.user.flds == null || this.user.flds.length == 0) { 70 this.errors.splice(7, 1, true); 71 } else { this.errors.splice(7, 1, false) } 72 } 73 if (this.employer_type == 'government' && this.user.affiliation == 'BLM' && this.user.title == 'Air Resource Specialist') { 74 if (this.user.state == null) { 75 this.errors.splice(6, 1, true); 76 } else { this.errors.splice(6, 1, false) } 77 } 78 if (this.errors.indexOf(true) != -1) { 79 this.$q.notify({ color: 'red', icon: 'error', textColor: 'grey-1', message: 'Please fix form errors.'}) 80 return; 81 } 82 this.step++; 83 break; 84 case 2: 85 if (this.role == 'external' && this.user.modules[8] == true) { this.user.modules.splice(8,1, false) } 86 if (this.user.modules.indexOf(true) != -1) { 87 this.step++; 88 } else { this.$q.notify({ color: 'red', icon: 'error', textColor: 'grey-1', message: 'You must select at least one module to continue.'}) } 89 break; 90 case 3: this.step++; break; 91 case 4: 92 if (this.user.passcode == '' || this.match == '') { 93 this.passError = 'Password and re-entry verification are required!'; 94 this.errors.splice(8, 1, true); 95 return; 96 } else { this.errors.splice(8, 1, false) } 97 if (!RegExp('^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^_&*-]).{8,12}$').test(this.user.passcode)) { 98 this.passError = 'Password does not meet minimum requirements'; 99 this.errors.splice(8, 1, true); 100 return; 101 } else { this.errors.splice(8, 1, false) } 102 if (this.user.passcode.indexOf(' ') != -1) { 103 this.passError = 'Password must not contain any space charactors!'; 104 this.errors.splice(8, 1, true); 105 return; 106 } else { this.errors.splice(8, 1, false) } 107 if (this.user.passcode != this.match) { 108 this.passError = 'Password verification failed!'; 109 this.errors.splice(8, 1, true); 110 return; 111 } else { this.errors.splice(8, 1, false) } 112 if (this.errors.indexOf(true) == -1) { this.register() } 113 break; 114 default: this.step++; 115 } 116 }, 117 register() { 118 let user = JSON.parse(JSON.stringify(this.user)), mods = [];
119 user.modules.forEach( function(m, indx) { 120 if (m == true) { mods.push(this.modules[indx].name) } 121 }, this); 122 user.modules = mods; 123 124 user['acct_type'] = this.role; 125 user['bio'] = ''; 126 user['discoverable'] = false; 127 user['govt'] = (this.employer_type == 'private') ? false : true; 128 user['log_cnt'] = 1; 129 user['rating'] = 0; 130 user['reversed'] = false; 131 user['seed'] = 'long'; 132 user['work_address'] = ''; 133 134 emit.fb({ op: 'register', user: user }); 135 } 136 }, 137 watch: { 138 employer_type() { this.user.affiliation = '' }, 139 140 'user.affiliation': function() { 141 this.user.title = ''; 142 this.user.state = null; 143 this.user.flds = null; 144 this.user.oversight = false; 145 }, 146 'user.title': function() { 147 this.user.state = null; 148 this.user.flds = null; 149 this.user.oversight = false; 150 }, 151 'user.state': function() { 152 this.user.flds = null; 153 this.fields = emit.qry({ typ: 'lookup', q: { '$and': [ 154 { component: 'create' }, 155 { target: 'fields' }, 156 { filter: this.user.state } 157 ]} }); 158 } 159 } 160}
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.