import Ember from 'ember';

import {
  validator, buildValidations
}
from 'ember-cp-validations';

/**
* Validations for adding unregistered contributor form.  fullName must be present
* and have three letters, and the username (email) must be present and of appropriate format.
*/
const Validations = buildValidations({
    fullName: {
        description: 'Full Name',
        validators: [
            validator('presence', true),
            validator('length', {
                min: 3
            })
        ]
    },
    username: {
        validators: [
            validator('presence', true),
            validator('format', {
                type: 'email'
            })
       ]
    },
});

export default Ember.Component.extend(Validations, {
    fullName: null,
    username: null,
    isFormValid: Ember.computed.alias('validations.isValid'),
});

@@ -658,16 +658,298 @@
  'email'
+,%0A                regex: /%5E%5B-a-z0-9~!$%25%5E&*_=+%7D%7B%5C'?%5D+(%5C.%5B-a-z0-9~!$%25%5E&*_=+%7D%7B%5C'?%5D+)*@(%5Ba-z0-9_%5D%5B-a-z0-9_%5D*(%5C.%5B-a-z0-9_%5D+)*%5C.(aero%7Carpa%7Cbiz%7Ccom%7Ccoop%7Cedu%7Cgov%7Cinfo%7Cint%7Cmil%7Cmuseum%7Cname%7Cnet%7Corg%7Cpro%7Ctravel%7Cmobi%7C%5Ba-z%5D%5Ba-z%5D)%7C(%5B0-9%5D%7B1,3%7D%5C.%5B0-9%5D%7B1,3%7D%5C.%5B0-9%5D%7B1,3%7D%5C.%5B0-9%5D%7B1,3%7D))(:%5B0-9%5D%7B1,5%7D)?$/i,
 %0A       

Add email reggae to unregistered-contributor-form.