Author: jleroux
Date: Fri Nov 9 14:19:36 2007 New Revision: 593671 URL: http://svn.apache.org/viewvc?rev=593671&view=rev Log: A patch from Dan Shields "Passwords in POS are shown in clear text" (https://issues.apache.org/jira/browse/OFBIZ-1106) - OFBIZ-1106 Added: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/InputWithPassword.java (with props) Modified: ofbiz/trunk/specialpurpose/pos/screens/default/includes/posinput.xml ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/SecurityEvents.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PosScreen.java Modified: ofbiz/trunk/specialpurpose/pos/screens/default/includes/posinput.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/screens/default/includes/posinput.xml?rev=593671&r1=593670&r2=593671&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/screens/default/includes/posinput.xml (original) +++ ofbiz/trunk/specialpurpose/pos/screens/default/includes/posinput.xml Fri Nov 9 14:19:36 2007 @@ -22,6 +22,7 @@ <Panel name="toppan" x="0" y="1" w="1024" h="46" border="1" style="panel"> <Edit name="pos_output" x="2" y="2" w="618" h="42" style="input" border="0" alignment="Left"/> <Edit name="pos_input" x="622" y="2" w="400" h="42" style="input" border="0" alignment="Right"/> + <Password name="pos_inputpassword" x="622" y="2" w="400" h="42" style="input" border="0" alignment="Right"/> </Panel> </Components> </XPage> Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java?rev=593671&r1=593670&r2=593671&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java Fri Nov 9 14:19:36 2007 @@ -42,7 +42,7 @@ protected Stack functionStack = new Stack(); protected Component[] pageComs = null; protected Color lastColor = null; - protected XEdit input = null; + protected javax.swing.JTextField input = null; protected boolean isLocked = false; public Input(PosScreen page) { Added: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/InputWithPassword.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/InputWithPassword.java?rev=593671&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/InputWithPassword.java (added) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/InputWithPassword.java Fri Nov 9 14:19:36 2007 @@ -0,0 +1,51 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.pos.component; + +import net.xoetrope.swing.XPassword; +import org.ofbiz.pos.screen.PosScreen; + +public class InputWithPassword extends Input { + + protected javax.swing.JTextField savedInput; + protected XPassword password = null; + + public InputWithPassword( PosScreen page) { + super( page); + this.savedInput = super.input; + this.password = (XPassword)page.findComponent("pos_inputpassword"); + if( this.password == null) { + this.password = new XPassword(); + } + this.password.setVisible(false); + this.password.setFocusable(false); + } + public void setPasswordInput(boolean isPasswordInput) { + if( isPasswordInput) { + this.savedInput.setVisible(false); + this.password.setText(""); + this.password.setVisible( true); + super.input = this.password; + } else { + this.password.setVisible(false); + this.savedInput.setVisible( true); + super.input = this.savedInput; + } + } +} Propchange: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/InputWithPassword.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/InputWithPassword.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/InputWithPassword.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/SecurityEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/SecurityEvents.java?rev=593671&r1=593670&r2=593671&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/SecurityEvents.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/SecurityEvents.java Fri Nov 9 14:19:36 2007 @@ -21,7 +21,7 @@ import java.util.Locale; import org.ofbiz.pos.screen.PosScreen; -import org.ofbiz.pos.component.Input; +import org.ofbiz.pos.component.InputWithPassword; import org.ofbiz.pos.component.Output; import org.ofbiz.pos.PosTransaction; import org.ofbiz.base.util.UtilProperties; @@ -79,7 +79,7 @@ private static void baseLogin(PosScreen pos, boolean mgr) { XuiSession session = pos.getSession(); Output output = pos.getOutput(); - Input input = pos.getInput(); + InputWithPassword input = pos.getInput(); String loginFunc = mgr ? "MGRLOGIN" : "LOGIN"; String[] func = input.getLastFunction(); @@ -88,10 +88,13 @@ if (UtilValidate.isEmpty(func[1]) && UtilValidate.isEmpty(text)) { output.print(UtilProperties.getMessage("pos","ULOGIN",Locale.getDefault())); input.setFunction(loginFunc); + input.setPasswordInput( false); } else if (UtilValidate.isEmpty(func[1])) { output.print(UtilProperties.getMessage("pos","UPASSW",Locale.getDefault())); input.setFunction(loginFunc); + input.setPasswordInput( true); } else { + input.setPasswordInput( false); String username = func[1]; String password = text; if (!mgr) { Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PosScreen.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PosScreen.java?rev=593671&r1=593670&r2=593671&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PosScreen.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PosScreen.java Fri Nov 9 14:19:36 2007 @@ -39,7 +39,7 @@ import org.ofbiz.guiapp.xui.XuiSession; import org.ofbiz.pos.PosTransaction; import org.ofbiz.pos.adaptor.KeyboardAdaptor; -import org.ofbiz.pos.component.Input; +import org.ofbiz.pos.component.InputWithPassword; import org.ofbiz.pos.component.Journal; import org.ofbiz.pos.component.Operator; import org.ofbiz.pos.component.Output; @@ -63,7 +63,7 @@ protected ClassLoader classLoader = null; protected XuiSession session = null; protected Output output = null; - protected Input input = null; + protected InputWithPassword input = null; protected Journal journal = null; protected Operator operator = null; protected PosButton buttons = null; @@ -89,7 +89,7 @@ // setup the shared components this.session = XuiContainer.getSession(); this.output = new Output(this); - this.input = new Input(this); + this.input = new InputWithPassword(this); this.journal = new Journal(this); this.operator = new Operator(this); this.setLastActivity(System.currentTimeMillis()); @@ -256,7 +256,7 @@ return this.session; } - public Input getInput() { + public InputWithPassword getInput() { return this.input; } |
Free forum by Nabble | Edit this page |