1 20 21 package com.methodhead.reg; 22 23 import java.io.Serializable ; 24 import javax.servlet.http.HttpServletRequest ; 25 26 import org.apache.struts.action.ActionMapping; 27 import org.apache.struts.action.ActionErrors; 28 import org.apache.struts.action.ActionError; 29 import org.apache.struts.validator.DynaValidatorForm; 30 import com.methodhead.reg.User; 31 import com.methodhead.reg.RegPolicy; 32 import com.methodhead.reg.Role; 33 import com.methodhead.util.StrutsUtil; 34 import com.methodhead.sitecontext.SiteContext; 35 import java.util.Iterator ; 36 37 public class SendPasswordForm 38 extends 39 DynaValidatorForm 40 implements 41 Serializable { 42 43 public ActionErrors validate( 44 ActionMapping mapping, 45 HttpServletRequest request ) { 46 47 ActionErrors errors = super.validate( mapping, request ); 48 49 if ( errors.isEmpty() ) { 50 51 RegPolicy policy = ( RegPolicy )StrutsUtil.getPolicy( mapping ); 55 User user = policy.newRegUser(); 56 57 if ( !user.loadForLogin( ( String )get( "email" ) ) ) { 61 errors.add( 62 "email", new ActionError( "reg.sendpassword.noSuchUser" ) ); 63 } 64 } 65 66 return errors; 67 } 68 } 69 | Popular Tags |