1 package org.campware.cream.modules.screens; 2 3 42 43 44 import org.apache.turbine.util.RunData; 45 46 import org.apache.torque.util.Criteria; 47 48 import org.apache.velocity.context.Context; 49 50 import org.campware.cream.om.TurbineUser; 51 import org.campware.cream.om.TurbineUserPeer; 52 53 57 public class PasswordForm extends CreamForm 58 { 59 protected void initScreen() 60 { 61 setModuleType(LOOKUP); 62 setModuleName("PASSWORD"); 63 setIdName(TurbineUserPeer.USER_ID); 64 setFormIdName("userid"); 65 } 66 67 protected boolean getEntry(Criteria criteria, Context context) 68 { 69 try 70 { 71 72 Criteria crit = new Criteria(); 73 crit.add(TurbineUserPeer.LOGIN_NAME, myData.getUser().getName()); 74 75 TurbineUser entry = (TurbineUser) TurbineUserPeer.doSelect(crit).get(0); 76 context.put("entry", entry); 77 return true; 78 } 79 catch (Exception e) 80 { 81 return false; 82 } 83 } 84 85 protected boolean isAuthorized( RunData data ) throws Exception 86 { 87 88 initScreen(); 89 boolean isAuthorized = false; 90 91 if (data.getUser().hasLoggedIn()) 92 { 93 isAuthorized = true; 94 } 95 else 96 { 97 data.setMessage("Sorry, you don't have permission for this operation!"); 98 data.setScreenTemplate("CreamError.vm"); 99 100 isAuthorized = false; 101 } 102 103 return isAuthorized; 104 } 105 106 } 107 | Popular Tags |