]> andersk Git - moira.git/commitdiff
Implement CLGN (server) / LOGC (client) protocol exchange for checking
authorzacheiss <zacheiss>
Wed, 29 Jun 2005 06:41:27 +0000 (06:41 +0000)
committerzacheiss <zacheiss>
Wed, 29 Jun 2005 06:41:27 +0000 (06:41 +0000)
if a username is available and giving the user a chance to decide if
they want it or not.

clients/regapplet/regapplet/Parser.java
clients/regapplet/regapplet/Regapplet.java
clients/regapplet/regapplet/Sender.java
clients/regapplet/regapplet/Worker.java

index 26eba26e0c8636649057d312eb08c5b940cb1789..1c8d95e24df8e625585403b38ee2a317006da681 100644 (file)
@@ -72,6 +72,17 @@ public class Parser {
           worker.setState(Worker.SENDLOGIN);
          worker.applet.showLoginDiag();
        }
+     } else if (pdat[1].equals("LOGC")) {
+       if (!pdat[4].equals("")) {
+        worker.applet.chosenlogin = pdat[4];
+       } else worker.applet.chosenlogin = "";
+       if (!pdat[2].equals("")) {
+         worker.setState(Worker.DIALOG, Worker.CONFIRMLOGIN);
+         worker.applet.showMessage(pdat[2], true);
+       } else {
+         worker.setState(Worker.CONFIRMLOGIN);
+         worker.applet.showLoginDiag();
+       }
      } else if (pdat[1].equals("GETP")) {
        if (!pdat[2].equals("")) {
           worker.setState(Worker.DIALOG, Worker.SENDPASSWD);
index c3505052202a11d85cad5640a9133ab8fbfc5020..de77b1711188dfa16d721dd5c88620b123eceb3f 100755 (executable)
@@ -68,6 +68,13 @@ public class Regapplet extends Applet {
   Label PinLabel = new Label();
   GridBagLayout gridBagLayout7 = new GridBagLayout();
 
+  // login confirmation panel.
+  Panel LoginConfirmPanel = new Panel();
+  TextBlock LoginConfirmInstructions = new TextBlock(600,40);
+  Button LoginConfirmCancelButton = new Button();
+  Button LoginConfirmContButton = new Button();
+  GridBagLayout gridBagLayout8 = new GridBagLayout();
+
   Panel LoginPanel = new Panel();
   TextBlock LoginNameBanner = new TextBlock(600,30);
   Label LoginNameLabel = new Label();
@@ -96,6 +103,7 @@ public class Regapplet extends Applet {
   public Worker worker = null;
   public Thread workthread = null;
   public String guesslogin = "";
+  public String chosenlogin = "";
  
   //Get a parameter value
   public String getParameter(String key, String def) {
@@ -156,6 +164,12 @@ public class Regapplet extends Applet {
     PinCancelButton.setBackground(Color.white);
     Pin.setEchoCharacter('*');
 
+    // login confirmation initialization.
+    LoginConfirmContButton.setLabel("Continue");
+    LoginConfirmContButton.setBackground(Color.white);
+    LoginConfirmCancelButton.setLabel("Cancel");
+    LoginConfirmCancelButton.setBackground(Color.white);
+
     ExitButton.setLabel("Exit");
     ExitButton.setBackground(Color.white);
     LoginNameLabel.setText("Chosen Login Name: ");
@@ -251,10 +265,20 @@ public class Regapplet extends Applet {
     WordPanel.add(WordCancelButton);
     gridBagLayout1.setConstraints(WordCancelButton, new GridBagConstraints2(4, 3, 2, 2, 0.0, 1.0
             ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 0, 10, 0), 0, 0));
-
+    this.add("LoginConfirmPanel", LoginConfirmPanel);
+    LoginConfirmPanel.add(LoginConfirmInstructions);
+    gridBagLayout8.setConstraints(LoginConfirmInstructions, new GridBagConstraints2(0, 0, 3, 3, 0.0, 0.0
+            ,GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0));
+    LoginConfirmPanel.add(LoginConfirmContButton);
+    gridBagLayout8.setConstraints(LoginConfirmContButton, new GridBagConstraints2(1, 4, 1, 1, 0.0, 1.0
+                  ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 0, 20, 0), 0, 0));
+    LoginConfirmPanel.add(LoginConfirmCancelButton);
+    gridBagLayout8.setConstraints(LoginConfirmCancelButton, new GridBagConstraints2(2, 4, 1, 1, 0.0, 1.0
+                  ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(10, 0, 20, 0), 0, 0));
     this.add("PinPanel", PinPanel);
     PinPanel.add(PinInstructions);
-        gridBagLayout7.setConstraints(PinInstructions, new GridBagConstraints2(0, 0, 4, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(20, 10, 10, 20), 0, 0));
+    gridBagLayout7.setConstraints(PinInstructions, new GridBagConstraints2(0, 0, 4, 1, 0.0, 0.0
+           ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(20, 10, 10, 20), 0, 0));
     PinPanel.add(PinLabel);
     gridBagLayout7.setConstraints(PinLabel, new GridBagConstraints2(0, 1, 1, 1, 0.0, 0.0
             ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(20, 10, 0, 0), 0, 0));
@@ -356,6 +380,7 @@ public class Regapplet extends Applet {
     Word6.setText("");
     Pin.setText("");
     guesslogin = "";
+    chosenlogin = "";
   }
 
   //Start the applet
@@ -424,6 +449,14 @@ public class Regapplet extends Applet {
     LoginName.requestFocus();
   }
 
+  public void showLoginConfirmDiag() {
+    if (!chosenlogin.equals("")) {
+    LoginConfirmInstructions.setText("We have confirmed that the Athena username " + chosenlogin + " is available for your use." + "\n" + "If you choose to continue, your email address will be " + chosenlogin + "@mit.edu, and any personal web content you choose to publish will be available at the URL http://web.mit.edu/" + chosenlogin + "/www/ . After choosing to continue, this username will be registered for you without further confirmation, and CANNOT BE CHANGED." + "\n" + "Are you sure you would like to proceed?");
+    }
+    cardLayout1.show(this, "LoginConfirmPanel");
+    LoginConfirmContButton.requestFocus();
+  }
+
   public void showPassDiag() {
     cardLayout1.show(this, "PasswordPanel");
     Password1.requestFocus();
@@ -497,17 +530,21 @@ public class Regapplet extends Applet {
       return true;
     } else if ((evt.target == WordContButton) ||
               (evt.target == PinContButton) || 
-               (evt.target == LoginContButton) ||
+               (evt.target == LoginConfirmContButton) ||
+              (evt.target == LoginContButton) ||
                (evt.target == PasswordContButton) ||
                (evt.target == NameContButton) ||
               (evt.target == MITID) ||
-              (evt.target == Word6) ||
               (evt.target == LoginName) ||
+              (evt.target == Word6) ||
               (evt.target == Password2) ||
               (evt.target == RuleButton)) {
       workthread = new Thread(worker);
       workthread.start();
       return true;
+    } else if (evt.target == LoginConfirmCancelButton) {
+         chosenlogin = "";
+         showLoginDiag();
     } else if (evt.target == ExitButton) {
       if (isStandalone) System.exit (0);
     } else if (evt.target == NameCancelButton ||
index 7fb599cd6dc27156b5e423d0fac59762a2969bea..4be58b8bf9511ca3fa98138a20e4bdae4fa1fbe2 100644 (file)
@@ -69,6 +69,11 @@ public class Sender {
      sendstring(s);
   }
   public void SendLogin(String Login) {
+     String s;
+     s = "v1" + '\0' + "CLGN" + '\0' + Login + '\0';
+     sendstring(s);
+  }
+  public void ConfirmLogin(String Login) {
      String s;
      s = "v1" + '\0' + "LOGN" + '\0' + Login + '\0';
      sendstring(s);
index 61e3eaeff6b8976ea64ee93c30a08f25f1153b83..0caea1635b4b7686d9ab0d12b8b642afcc828217 100644 (file)
@@ -15,6 +15,7 @@ public class Worker implements Runnable {
   public static final int DIALOG = 5;
   public static final int INIT1 = 6;
   public static final int SENDPIN = 7;
+  public static final int CONFIRMLOGIN = 8;
   int oldstate = INIT;
   int state = INIT;
   int nextstate = INIT;
@@ -43,6 +44,9 @@ public class Worker implements Runnable {
            case SENDLOGIN:
                applet.showLoginDiag();
                break;
+          case CONFIRMLOGIN:
+               applet.showLoginConfirmDiag();
+               break;
           case SENDPASSWD:
                applet.showPassDiag();
                break;
@@ -136,6 +140,10 @@ public class Worker implements Runnable {
        applet.showMessage("Please wait...");
        send.SendLogin(applet.LoginName.getText());
        break;
+      case CONFIRMLOGIN:
+       applet.showMessage("Please wait...");
+       send.ConfirmLogin(applet.chosenlogin);
+       break;
       case SENDPASSWD:
        if (!(applet.Password1.getText().equals(applet.Password2.getText()))) {
          applet.Password1.setText("");
This page took 0.053292 seconds and 5 git commands to generate.