public boolean type(char k, java.awt.event.KeyEvent ev) {
   if (k == 10) {
     if ((cur != null) && cur.enter()) wdgmsg("login", cur.data());
     return (true);
   }
   return (super.type(k, ev));
 }
 public void testLoginSubmit() throws Exception {
   Login login = new Login();
   login.setUsername("username");
   login.setPassword("password");
   String result = login.execute();
   assertSuccess(result);
 }
  @OnMessage
  public WebsocketMessageWrapper doLogin(WebsocketMessageWrapper<Customer> message) {
    Customer customer =
        loginBean.findCustomer(message.getData().getEmail(), message.getData().getPassword());
    if (customer == null) {
      throw WebSocketServerLogger.LOG.customerNotFoundException(
          message.getData().getEmail(), message.getSequenceId());
    }

    ApiToken apiToken = loginBean.findValidToken(customer);
    if (apiToken == null) {
      apiToken = loginBean.createToken(customer);
    } else {
      apiToken = loginBean.refreshToken(apiToken);
    }

    // loginBean.refreshToken(customer.getEmail(), customer.getPassword(), message.getSequenceId());

    WebsocketMessageWrapper<ApiToken> token = new WebsocketMessageWrapper<>();
    token.setType(WebsocketMessageType.CUSTOMER_API_TOKEN);
    token.setSequenceId(message.getSequenceId());
    token.setData(apiToken);

    return token;
  }
 @RequestMapping("/exit.doAction")
 public String exit(HttpServletRequest request, HttpServletResponse response) {
   Login login = new Login();
   String yhid = login.getYhid(request);
   String login_redirect = "/login.jsp";
   /*try
   {
   	login_redirect = SysPara.getValue("login_redirect");
   }
   catch (Exception e)
   {
   	login_redirect = "/login.jsp";
   }*/
   Cookie cookies[] = request.getCookies();
   if (cookies != null) {
     for (int i = 0; i < cookies.length; i++)
       if (!cookies[i].getName().equals("com.ashburz_username")) {
         cookies[i].setValue(null);
         cookies[i].setMaxAge(0);
         response.addCookie(cookies[i]);
       }
   }
   if (!"".equals(yhid)) {
     login.removeCache(yhid);
     login.delSessionInfo(yhid);
   }
   return login_redirect;
 }
Beispiel #5
0
  private void btnSuperUserSubmitActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnSuperUserSubmitActionPerformed
    String IDNO = txtIDNO.getText();
    String OldPassword = txtOldPassword.getText();
    String NewPassword = txtNewPassword.getText();
    String ConfirmPassword = txtConfirmPassword.getText();
    String sqlQueryPwd = "select Password from super_user where IDNO=? and Password=?";
    String sqlQueryP =
        "update super_user set Password='******' where IDNO='" + IDNO + "'";
    try {
      PreparedStatement ps = x.prepareStatement(sqlQueryPwd);
      PreparedStatement ps1 = x.prepareStatement(sqlQueryP);
      ps.setString(1, IDNO);
      ps.setString(2, OldPassword);
      ResultSet rs = ps.executeQuery();

      if (rs.next() && NewPassword.equals(ConfirmPassword)) {
        ps1.execute(sqlQueryP);
        JOptionPane.showMessageDialog(null, "Password successfully changed!");
        dispose();
        Login L = new Login();
        L.setVisible(true);
      } else {
        JOptionPane.showMessageDialog(null, "Invalid! Cross check!");
      }
      rs.close();
    } catch (Exception e) {
      JOptionPane.showMessageDialog(null, e);
    }
  } // GEN-LAST:event_btnSuperUserSubmitActionPerformed
 public void wdgmsg(Widget sender, String msg, Object... args) {
   if (sender == btn) {
     if (cur.enter()) super.wdgmsg("login", cur.data());
     return;
   }
   super.wdgmsg(sender, msg, args);
 }
 /**
  * Checks if the current logged in account does not exceed the maximum amount of detentions a FREE
  * account should have
  *
  * @return true or false
  */
 public boolean doesFreeAccountNotHaveMaxDetentions() {
   loadLogin();
   if (currentLogin.getAccountType() == AccountType.Free
       && currentLogin.getDetentions().size() < MAX_DETENTIONS_FOR_FREE) {
     return true;
   }
   return currentLogin.getAccountType() != AccountType.Free;
 }
Beispiel #8
0
 /** @param args the command line arguments */
 public static void main(String[] args) throws Exception {
   ASystem.systemPositional(true);
   ASystem.setIsLinear(false);
   Login l = new Login();
   l.Welcome_Speech = "welcome to login";
   l.setVisible(true);
   BLog.writeLog("Start");
 }
 // Needs access to an envinronment that includes validators
 public void FIXME_testLoginSubmitInput() throws Exception {
   Login login = new Login();
   String result = login.execute();
   assertInput(result);
   Map errors = assertFieldErrors(login);
   assertFieldError(errors, "username", "Username is required.");
   assertFieldError(errors, "password", "Password is required.");
 }
Beispiel #10
0
  @Action
  public Response processConfirmBooking(
      String confirm,
      String id,
      String checkinDate,
      String checkoutDate,
      String beds,
      String smoking,
      String creditCard,
      String creditCardName,
      String creditCardExpiryMonth,
      String creditCardExpiryYear) {
    Hotel hotel = Hotel.findById(id);
    User user = User.find(login.getUserName(), null);
    Booking booking = new Booking(hotel, user);
    booking.checkinDate = checkinDate;
    booking.checkoutDate = checkoutDate;
    booking.beds = Integer.parseInt(beds);
    booking.smoking = Boolean.valueOf(smoking);
    booking.creditCard = creditCard;
    booking.creditCardName = creditCardName;
    booking.creditCardExpiryMonth = Integer.parseInt(creditCardExpiryMonth);
    booking.creditCardExpiryYear = Integer.parseInt(creditCardExpiryYear);

    //      validation.valid(booking);

    /*
           // Errors or revise
           if(validation.hasErrors() || params.get("revise") != null) {
               render("@book", hotel, booking);
           }

           // Confirm
    */
    if (confirm != null) {
      booking.create();
      flash.setSuccess(
          "Thank you, "
              + login.getUserName()
              + ", your confimation number for "
              + hotel.name
              + " is "
              + booking.id);
      return Hotels_.index();
    } else {
      // Display booking
      return Hotels_.confirmBooking(
          id,
          checkinDate,
          checkoutDate,
          beds,
          smoking,
          creditCard,
          creditCardName,
          creditCardExpiryMonth,
          creditCardExpiryYear);
    }
  }
Beispiel #11
0
 /**
  * @param args the command line arguments
  * @throws java.sql.SQLException
  */
 public static void main(String[] args) throws SQLException {
   Operacoes op = new Operacoes();
   op.Setroot();
   Principal roda = new Principal();
   Login login = new Login();
   login.setLogin(true);
   login.LayoutLogin();
   roda.layout();
 }
Beispiel #12
0
 /**
  * Get Role for User
  *
  * @return role
  */
 public MRole getRole() {
   if (m_role == null) {
     if (m_login == null
         || m_login.getRole() == null
         || m_login.getAD_Role_ID() == -1
         || m_login.getAD_User_ID() == -1) throw new IllegalArgumentException("Not logged in yet");
     m_role = m_login.getRole();
   }
   return m_role;
 } // getRole
Beispiel #13
0
 private void jMenuItem1ActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jMenuItem1ActionPerformed
   // TODO add your handling code here:
   int dialogResult =
       JOptionPane.showConfirmDialog(
           null, "Do you want to Log-out?", "Warning", JOptionPane.YES_NO_OPTION);
   if (dialogResult == JOptionPane.YES_OPTION) {
     Login login = new Login();
     login.setVisible(true);
     this.dispose();
   }
 } // GEN-LAST:event_jMenuItem1ActionPerformed
 /**
  * Will log the user into the web site using container managed security
  *
  * @return Will take the user to the Welcome page or will return the user back to the log in page
  *     with an error message
  */
 public String login() {
   FacesContext context = FacesContext.getCurrentInstance();
   HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
   try {
     // If the log in is successful..
     request.login(currentLogin.getUsername(), currentLogin.getPassword());
     return "welcome?faces-redirect=true";
   } catch (ServletException e) {
     // else...
     displayMessage("Username or password is incorrect!");
     return null;
   }
 }
Beispiel #15
0
 /**
  * Tries to authorize current connection and throws AuthenticationErrorException if not
  * successful.
  *
  * <p>Retrieved token is stored for later use with all commands that need authentication.
  */
 public void login(@NotNull String userName, @NotNull String password)
     throws AuthenticationErrorException, CommandExecutionException, IOException {
   final Login login = new Login(this);
   login.setParameter("login", userName);
   login.setParameter("password", password);
   final CommandResult<String> result = execute(login);
   if (result.success()) {
     authorization = result.getResult();
     this.userName = userName;
     this.password = password;
     timeout = Calendar.getInstance().getTimeInMillis();
   } else throw new AuthenticationErrorException(this, userName, password.replaceAll(".", "*"));
 }
  @Test
  public void logInMethodShouldReturn1WhenUserIsLogIn() {
    ArrayList<User> users = new ArrayList<User>();
    users.add(
        new User(
            "pravin", "*****@*****.**", "8087648479", "librarian", "123-1234", "1231234"));
    User user1 =
        new User(
            "pravin123", "*****@*****.**", "8087648479", "user", "123-1235", "1231234");
    users.add(user1);
    Login login = new Login(users);

    assertEquals(user1, login.logIn("123-1235", "1231234"));
  }
  public void init() {

    comm = new GenericComm();
    myPlayerNum = comm.getMyNumber();
    Debug.msg("myPlayerNum is: #" + myPlayerNum);
    comm.setDebugValues("C_COMM", 0);

    Login myLogin = new Login();
    comm.sendMessage(myLogin.pack());

    theDisplay = new ClientDisplay(theUniverse, theMarket);
    Debug.msg("Initializing Complete.");

    initTimer();
  }
Beispiel #18
0
 private void menuLockScreenActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_menuLockScreenActionPerformed
   try {
     JOptionPane.showMessageDialog(
         this,
         "System Locked! Press OK to Release",
         "Open MRM System",
         javax.swing.JOptionPane.INFORMATION_MESSAGE);
     dispose();
     Login login = new Login();
     login.setVisible(true);
   } catch (Exception ex) {
     Logger.getLogger(MainMenu.class.getName()).log(Level.SEVERE, null, ex);
   }
 } // GEN-LAST:event_menuLockScreenActionPerformed
 public void wdgmsg(Widget sender, String name, Object... args) {
   if (sender == btn) {
     LoginScreen.this.wdgmsg("forget");
     return;
   }
   super.wdgmsg(sender, name, args);
 }
 /** Displays LoginScreen */
 private void displayLogin() {
   // true
   back.setVisible(true);
   Login.setVisible(true);
   Login2.setVisible(true);
   SmallInput.setVisible(true);
   SmallInput2.setVisible(true);
   SmallInput3.setVisible(true);
   SmallInput4.setVisible(true);
   SmallInput5.setVisible(true);
   CreateNewAccount.setVisible(true);
   Create.setVisible(true);
   username.setVisible(true);
   password.setVisible(true);
   newUsername.setVisible(true);
   newPassword.setVisible(true);
   verifyPassword.setVisible(true);
   loginCreate.setVisible(true);
   loginCreate.setOpaque(false);
   // false
   serversError.setVisible(false);
   Credits.setVisible(false);
   NetworkMode.setVisible(false);
   Online.setVisible(false);
   Lan.setVisible(false);
   Servers.setVisible(false);
   BigInput2.setVisible(false);
   LongInput.setVisible(false);
   LongInput2.setVisible(false);
   Join.setVisible(false);
   Create2.setVisible(false);
   returnToMain.setVisible(false);
   ip.setVisible(false);
   serverName.setVisible(false);
 }
 /** Displays Network screen. */
 private void displayNetworkMode() {
   // true
   NetworkMode.setVisible(true);
   Online.setVisible(true);
   Lan.setVisible(true);
   back.setVisible(true);
   // false
   loginCreate.setVisible(false);
   PlayerVsComp.setVisible(false);
   PlayerVsPlayer.setVisible(false);
   TwoPlayerVsTwoPlayer.setVisible(false);
   Credits.setVisible(false);
   Login.setVisible(false);
   Login2.setVisible(false);
   SmallInput.setVisible(false);
   SmallInput2.setVisible(false);
   SmallInput3.setVisible(false);
   SmallInput4.setVisible(false);
   SmallInput5.setVisible(false);
   CreateNewAccount.setVisible(false);
   Create.setVisible(false);
   username.setVisible(false);
   password.setVisible(false);
   newUsername.setVisible(false);
   newPassword.setVisible(false);
   verifyPassword.setVisible(false);
 }
 public void start() throws Exception {
   int menuOption = 1;
   while (menuOption != 2) {
     inputOutput.printLogInQuit();
     menuOption = inputOutput.readInputFromConsole();
     switch (menuOption) {
       case 1:
         inputOutput.printEnterLoginId();
         User whoIsLogin =
             login.logIn(inputOutput.readStringFromConsole(), inputOutput.readPassword());
         if (whoIsLogin.getRoll().equals("user")) {
           while (menuOption != 8) {
             inputOutput.printMenuOnConsoleForUser();
             inputOutput.printEnterYourChoice();
             menuOption = inputOutput.readInputFromConsole();
             dispatcherForOption(inputOutput, library, menuOption, whoIsLogin);
           }
         } else if (whoIsLogin.getRoll().equals("librarian")) {
           while (menuOption != 8) {
             inputOutput.printMenuOnConsoleForAdmin();
             inputOutput.printEnterYourChoice();
             menuOption = inputOutput.readInputFromConsole();
             dispatcherForOption(inputOutput, library, menuOption, whoIsLogin);
           }
         } else {
           inputOutput.printValidationProblem();
         }
         break;
       case 2:
         System.exit(0);
       default:
         inputOutput.printInvalidOptionMessage();
     }
   }
 }
Beispiel #23
0
  public static void main(String[] args) throws InterruptedException {

    WebDriver driver = new FirefoxDriver();
    Login.login(driver);
    //		String requestNumber = RequestActions.createRequest(driver);
    RequestActions.approveRequest(driver, "%10119");
  }
Beispiel #24
0
  public String doLogin() {
    boolean b = false;
    b = log.logincheck();
    System.out.println("loginaction=" + b);

    if (b == true) return "success";
    else return "unsuccess";
  }
 @Override
 public boolean hasRole(String role) {
   if (role.equals(login.getRole())) {
     return true;
   } else {
     return false;
   }
 }
 private void loginActionPerformed(java.awt.event.ActionEvent evt) {
   CardLayout card = (CardLayout) mainPanel.getLayout();
   String user = userField.getText();
   String pass = passField.getText();
   String section = sectionField.getText().trim();
   if (Login.isValid(user, pass) == 2) {
     if (Pattern.matches("[a-zA-Z]", section)) {
       curr = new Worker(user, pass, section);
       card.show(mainPanel, "workerCard");
     } else {
       JOptionPane.showMessageDialog(null, "Invalid section");
     }
   } else if (Login.isValid(user, pass) == 1) {
     card.show(mainPanel, "managerCard");
   } else {
     JOptionPane.showMessageDialog(null, "Invalid username/password.");
   }
 }
Beispiel #27
0
 public void registerNewUser(View view) {
   ConnectivityManager connMgr =
       (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
   NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
   if (networkInfo != null && networkInfo.isConnected()) {
     new MyClass().execute(REGISTER_URL);
   } else {
     Login.makeToast(this, "Network Unavailable");
   }
 }
Beispiel #28
0
 protected String loginAttributeName(final Login login) {
   switch (login.getType()) {
     case USERNAME:
       return userNameAttribute();
     case EMAIL:
       return userEmailAttribute();
     default:
       throw new IllegalArgumentException("Unsupported login type");
   }
 }
Beispiel #29
0
  public static void logintogmail(WebDriver driver) throws IOException {

    ArrayList loginDetails = new ArrayList();
    ArrayList<LoginObj> userlist = new ArrayList<LoginObj>();
    String filePath = System.getProperty("user.dir");
    userlist = Util.readexcel(filePath, Constants.Filename, Constants.Sheetname);

    for (LoginObj lm : userlist) {
      username = lm.username;
      password = lm.password;

      Login.txtbx_UserName(driver).sendKeys(username);

      Login.btn_Next(driver).click();

      Login.txtbx_Password(driver).sendKeys(password);

      Login.btn_LogIn(driver).click();
    }
  }
  @RequestMapping("/login.doAction")
  public String login(HttpServletRequest request, HttpServletResponse response) {
    String dlmc = request.getParameter("dlmc");
    String password = request.getParameter("mm");
    Login login = new Login();
    /*if(!login.valiNum()){
    	request.setAttribute("ifdl", "true");
    	request.setAttribute("warning", "系统注册未成功");
    	return "/login.jsp";
    }*/
    String login_redirect = "";
    boolean login_cookie = false;
    try {
      login_redirect = SysPara.getValue("login_redirect");
    } catch (Exception e) {
      login_redirect = "/login.jsp";
    }
    request.setAttribute("ifdl", "true");
    if ("".equals(dlmc) || dlmc == null) {
      dlmc = login.getCookieValue(request, "com.ashburz_username");
      password = login.getCookieValue(request, "com.ashburz_password");
      if ("".equals(password) || password == null) {
        request.setAttribute("dlmc", dlmc);
        return login_redirect;
      }
      Des des = new Des();
      password = des.getDesString(password);
      login_cookie = true;
    }
    String mainpage_url = (new StringBuilder("main.jsp?guid=")).append(Guid.get()).toString();
    String yhid = "";
    String isUSBKey = request.getParameter("isUSBKey");
    String plain_pass = password;
    password = Md5.getMd5(password);

    if (login.validate(dlmc, password)) {
      yhid = login.getYhid(dlmc);
      if (!login_cookie) {
        Cookie cookie_username = new Cookie("com.ashburz_username", dlmc);
        cookie_username.setMaxAge(0x1e13380);
        response.addCookie(cookie_username);
        if ("1".equals(request.getParameter("mem_pass"))) {
          Cookie cookie_pass =
              new Cookie("com.ashburz_password", (new Des()).getEncString(plain_pass));
          cookie_pass.setMaxAge(0x1e13380);
          response.addCookie(cookie_pass);
        }
      }
      if (login_cookie) login.resetLoginInfo(response, dlmc, yhid);
      else login.setLoginInfo(request, response, login, yhid, dlmc);
      return mainpage_url;
    } else {
      request.setAttribute("warning", "用户名或密码错误!!");
      return login_redirect;
    }
  }