1 25 26 package net.killingar.forum.actions; 27 28 public class Login 29 extends ActionForumSupport 30 { 31 String username = ""; 33 String password = ""; 34 String url = ""; 35 36 38 public void setUsername(String username) { this.username = username; } 40 public void setPassword(String password) { this.password = password; } 41 public void setUrl(String in) { this.url = in; } 42 43 public String getUsername() { return username; } 45 public String getPassword() { return password; } 46 public String getUrl() { return url; } 47 48 protected String doExecute() 50 { 51 try 52 { 53 if (username.equals("")) 54 return INPUT; 55 56 javax.servlet.http.HttpServletRequest req = webwork.action.ActionContext.getContext().getRequest(); 58 if (!manager.login(username, password, req.getRemoteUser()+" "+req.getRemoteAddr())) 59 { 60 addErrorMessage("login failed, invalid username or password"); 61 return INPUT; 62 } 63 64 return SUCCESS; 65 } 66 catch (Exception e) 67 { 68 addErrorMessage("login failed, exception thrown ("+e.toString()+")"); 69 e.printStackTrace(); 70 return ERROR; 71 } 72 } 73 } | Popular Tags |