MemberMgr.evalLogin (username, password)
check if a login attempt is ok

  • Parameter String:
    username
  • Parameter String:
    password
  • Returns
    Obj Object containing two properties: - error (boolean): true if error happened, false if everything went fine - message (String): containing a message to user
Sourcecode in MemberMgr/objectFunctions.js:
1:   function evalLogin(username, password) {
2:      // check if login is successful
3:      if (!session.login(username, password))
4:         throw new Exception("loginTypo");
5:      // login was successful
6:      session.user.lastVisit = new Date();
7:      if (req.data.remember) {
8:         // user allowed us to set permanent cookies for auto-login
9:         res.setCookie("avUsr", session.user.name, 365);
10:        res.setCookie("avPw", Packages.helma.util.MD5Encoder.encode(session.user.password+req.data.http_remotehost), 365);
11:     }
12:     return new Message("welcome", [res.handlers.context.getTitle(), session.user.name]);
13:  }