OW2 - Online Registration.


<% import org.objectweb.jonas.mail.factory.JavaMail import javax.mail.*

import javax.naming.InitialContext; import javax.naming.Context;

import java.security.MessageDigest import tessdfgdfgsfdgsdfgsfdsdfgsdfgsfdgsdfgsdfgsdf1t.*

import groovy.sql.Sql // Create a password (PASSWORD_LENGHT characters) and crypt it using md5 def createPassword(){ java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5"); String stringa = "login" + "user" + (new Date()).toString();

bytedigest(stringa.get Bytes("UTF-8"));//Cripta String a = "" def i = 0 while ( i?);

return a.substring(0,6) }

def sentEmail(){ Context initialContext = new InitialContext() //SessionMailerHome sessionMailerHome = null;

//sessionMailer(initialContext);

port = 1025 // fixture = new EmailFixture(port)

props = new Properties() props.put('mail.smtp.host', 'localhost') // props.put('mail.smtp.port', port.toString()) session = Session.getDefaultInstance(props, null)

// Construct the message //msg = new MimeMessage(session) //registration= new InternetAddress('registrations@ow2.org') //partners = new InternetAddress('partners@mycompany.org') //msg.from = new InternetAddress('noreply@ow2.org') //msg.sentDate = new Date() //msg.subject = 'Successful build' //msg.setRecipient(Message.RecipientType.TO, registration) //msg.setRecipient(Message.RecipientType.CC, partners) //msg.setHeader('Organization', 'mycompany.org') //msg.setContent('Successful build for ' + new Date(),'text/plain')

// Send the message //Transport.send(msg)

//fixture.assertEmailArrived(from:'fiorentg@engg.it', // subject:'Successful build')

}

def sql = Sql.newInstance("jdbc:mysql://81.200.36.124/ow2, "ow2","lm2panpo_objectweb", "com.mysql.jdbc.Driver");

// ********** check about user login ****** def isUserAlreadyUsed(db,login){ def select ="SELECT count(*) count FROM t_user WHERE login ='${login}'";

def res = db.firstRow(select); if (res.count == 0) return false; else return true; }

// ********** Return true if the given organization is already registered def isOW2OrganizationAlreadyRegistered(db, name) { def select = "SELECT count(*) count FROM ow2_legal_entity_member WHERE name = '${name}'"; def res = db.firstRow(select); if (res.count == 0) return false; else return true; }

// ************ Return true if a legal entity representative is already registered with this email def isOW2EmailAlreadyUsedForLegalEntity(db, email){ def select = "SELECT count(*) count FROM ow2_legal_entity_member WHERE representative_email = '${email}'"; def res = db.firstRow(select); if (res.count == 0) return false; else return true; }

// ************ Return true if an individual is already registered with this email def isEmailAlreadyUsedForIndividual(db, email) { def select ="SELECT count(*) count FROM t_individual_member WHERE email = '${email}'"; def res = db.firstRow(select); if (res.count == 0) return false; else return true; }

def errorNumber = 0;

def login = request.getParameter("login"); if (login==null) login="";

def email= request.getParameter("email"); if (email==null) email="";

def firstName= request.getParameter("firstName"); if (firstName==null) firstName="";

def lastName= request.getParameter("lastName"); if (lastName==null) lastName="";

def membership= request.getParameter("membership"); if (membership==null) membership="";

def consortiumRead= request.getParameter("consortiumRead"); if (consortiumRead==null) consortiumRead="";

def organizationName= request.getParameter("organizationName"); if (organizationName==null) organizationName="";

def organizationWeb= request.getParameter("organizationWeb"); if (organizationWeb==null) organizationWeb="";

def work= request.getParameter("work"); if (work==null) work="";

def street1= request.getParameter("street1"); if (street1==null) street1="";

def street2= request.getParameter("street2"); if (street2==null) street2="";

def city= request.getParameter("city"); if (city==null) city="";

def state= request.getParameter("state"); if (state==null) state="";

def country= request.getParameter("country"); if (country==null) country="";

def zipCode= request.getParameter("zipCode"); if (zipCode==null) zipCode="";

def invoiceFirstName= request.getParameter("invoiceFirstName"); if (invoiceFirstName==null) invoiceFirstName="";

def invoiceLastName= request.getParameter("invoiceLastName"); if (invoiceLastName==null) invoiceLastName="";

def invoiceStreet1= request.getParameter("invoiceStreet1"); if (invoiceStreet1==null) invoiceStreet1="";

def invoiceStreet2= request.getParameter("invoiceStreet2"); if (invoiceStreet2==null) invoiceStreet2="";

def invoiceCity= request.getParameter("invoiceCity"); if (invoiceCity==null) invoiceCity="";

def invoiceState= request.getParameter("invoiceState"); if (invoiceState==null) invoiceState="";

def invoiceZipCode= request.getParameter("invoiceZipCode"); if (invoiceZipCode==null) invoiceZipCode="";

def invoiceCountry= request.getParameter("invoiceCountry"); if (invoiceCountry==null) invoiceCountry="";

def status= request.getParameter("status"); if (status==null) status="";

def er=false;

if (!er && (membership!= null && membership.size()!= 0 && membership!="strategic" && membership!="corporate" && membership!="individual")){ er = true; } if ((!er && login != null) && (login.size() < 2 || login.size() > 40) && (!(login==~"^a-z A-Z?{1}0-9a-z A-Z_?+$"))){ er = true; }

if (!er && (street1.size()== 0 || city.size()== 0|| zipCode.size()== 0|| country.size()== 0)){ er = true; } if (!er && (membership=="corporate" || membership=="strategic")&& (invoiceFirstName.size()== 0|| invoiceLastName.size()== 0 || invoiceStreet1.size()== 0|| invoiceCountry.size()== 0|| invoiceZipCode.size()== 0) ){ if (invoiceFirstName.size()!= 0|| invoiceLastName.size()!= 0 || invoiceStreet1.size()!= 0|| invoiceCountry.size()!= 0|| invoiceZipCode.size()!= 0) { er = true; } } if (!er && (membership =="strategic" || membership == "corporate")){ if (organizationName != null && organizationName.size() == 0 ){ er = true; } } if (!er && (work != null && work.size() == 0 )){ er = true; } if (!er && isUserAlreadyUsed(sql,login)){ er = true; } if (membership != null && membership.size() == 0){ er = true; }

if (!er && (membership == "corporate" || membership == "strategic" )) { if (isOW2EmailAlreadyUsedForLegalEntity(sql, email)) { er = true; } else { if ( membership == "individual" && isOW2EmailAlreadyUsedForIndividual(sql, email) ) { er = true; } } } if (!er && (consortiumRead==null || (consortiumRead != null && consortiumRead != 'y'))){ er = true; } errorNumber =0; if (er){%>

O W 2 Registration Wizard

Step 3 - Control Form

Warning
- Your session has expired. Please restart the OW2 On-Line Registration
<%}else{%>

O W 2 Registration Wizard

On-line Registration Wizard has successfully completed

Congratulation!

You have completed the pre-registration process for becoming a mmmmmmmm Member.

Two copies of your membership agreement have been automatically generated and will be sent soon in attachement of your confirmation email. Don't forget to send them to the enclosed postal address.

Press the button below to save your registration and check your mailbox to retrieve your pre-filled Membership Agreement and your password. Thanks.

<%}%> <% sql.close() %>

http://skins.ow2.org/skins/skinOW2/images/Featuredvideo.png
  • Mickael Bailly, Linagora
http://skins.ow2.org/skins/skinOW2/images/watchallvideos.png

 


This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 6.4.4 - Documentation
Powered by XWiki Hosted by Xsalto Free PageRank Checker Creative Commons 2.0 license Legal Notice