Helma logo
helma.org » Home > Stories > session.login()

session.login()

Logs in a user defined by its name and a password phrase, or by directly passing a HopObject.

There are two variants of session.login(): If called with two string arguments, it returns true if the user name / password pair matches the stored values in the database and false otherwise. If called with one HopObject argument, the session is associated with the user represented by the HopObject.

Syntax
session.login(usernameString, passwordString)
session.login(HopObject)

Example
var login = session.login("tobi", "mumbl3");
if (login)
  res.write("Welcome back, " + session.user.name + "!");
else
  res.write("Oops, please try again...");

Welcome back, tobi!


... comment


Page last modified on 2004-02-20 20:02 by hns