Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard

Diff Revisions d30bcc ... vs ccac99 ... for ruralHouses/src/gui/OwnerRegistrationGUI.java

Diff revisions: vs.
  @@ -41,10 +41,9 @@
41 41 * Create the frame.
42 42 */
43 43 public OwnerRegistrationGUI() {
44 -
44 +
45 45 try {
46 - am = (AdminInterface) Naming
47 - .lookup(___IntNames.AdminManager);
46 + am = (AdminInterface) Naming.lookup(___IntNames.AdminManager);
48 47 } catch (Exception e1) {
49 48 System.out.println("Error accessing remote authentication: "
50 49 + e1.toString());
  @@ -139,23 +138,32 @@
139 138
140 139 private void jButton_ActionPerformed(ActionEvent e) {
141 140
142 - Owner own = new Owner(this.nameField.getText(),
143 - this.bank1Field.getText() + " " + this.bank2Field.getText()
144 - + " " + this.bank3Field.getText() + " "
145 - + this.bank4Field.getText(), this.emailField.getText());
146 -
147 -
148 - try {
149 - if (this.am.addAccountRequest(this.userNameField.getText(),
150 - this.passField.getText(), own)) {
151 - this.am.saveInstance();
152 - this.feedback.setText("Request sended");
153 - } else {
154 - this.feedback.setText("Can't send the request");
141 + if (!emailField
142 + .getText()
143 + .matches(
144 + "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$")
145 + || !this.nameField.getText().isEmpty()||this.bank1Field.getText().length()!=4 || this.bank2Field.getText().length()!=4
146 + ||this.bank3Field.getText().length()!=2 || this.bank4Field.getText().length()!=10) {
147 + Owner own = new Owner(this.nameField.getText(),
148 + this.bank1Field.getText() + " " + this.bank2Field.getText()
149 + + " " + this.bank3Field.getText() + " "
150 + + this.bank4Field.getText(),
151 + this.emailField.getText());
152 +
153 + try {
154 + if (this.am.addAccountRequest(this.userNameField.getText(),
155 + this.passField.getText(), own)) {
156 + this.am.saveInstance();
157 + this.feedback.setText("Request sended");
158 + } else {
159 + this.feedback.setText("Can't send the request");
160 + }
161 + } catch (RemoteException e1) {
162 + // TODO Auto-generated catch block
163 + e1.printStackTrace();
155 164 }
156 - } catch (RemoteException e1) {
157 - // TODO Auto-generated catch block
158 - e1.printStackTrace();
165 + } else {
166 + this.feedback.setText("Bad formatted data");
159 167 }
160 168
161 169 }