Object | +--session
| SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods |
| Properties Summary | |
String |
_id
The unique identifier for a session object (session cookie). |
String |
cookie
The cookie value of a session. |
HopObject |
data
Object providing space for run-time user data (user cache). |
Date |
lastModified
The date a session was created or a login or logout was performed the last time. |
String |
message
If set, the message will be available during the next request as res.message |
User |
user
A reference to the user object associated with the current session. |
| Methods Summary | |
Date
|
lastActive()
A date object representing the time this user's session was last active. |
Boolean
|
login(<User> user,<String> password)
Logs in a user defined by its name and a password phrase, or by directly passing a HopObject. |
Date
|
onSince()
A date object representing the time a user's session was started. |
void
|
touch()
Refreshes the user's session. |
| Properties Detail |
String _id
res.writeln(session._id); 1fcca129764400@eefa22dfab
String cookie
res.writeln(session.cookie); 1fcca129764400@eefa22dfab
HopObject data
session.data.lastclick = new Date(); session.data.language = "en"; res.write(session.data); TransientNode session for (var p in session.data) res.writeln(p + ": " + session.data[p]); lastclick: Fri Jul 12 14:08:20 CEST 2002 language: en res.write(session.data.lastclick); Fri Jul 12 14:08:20 CEST 2002 res.write(session.data["language"]); en
Date lastModified
if (session.lastModified < this.modifytime)
renderSkin("main");
else
res.notModified();
String message
User user
session.login("tobi", "mumbl3");
res.write(session.user);
HopObject tobi
res.write(session.user.registered);
Thu Jun 28 17:25:33 CEST 2001
res.write(session.user["url"]);
http://helma.org
| Method Detail |
Date lastActive()
res.write(session.lastActive()) Thu Nov 02 16:12:13 GMT+01:00 2000
Boolean login(<User> user,<String> password)
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!
user - as User object to be logged in
user - as String, the username of the user to be checked
password - as String, if the first parameter is a username
Date onSince()
res.write(session.onSince()); Fri Aug 10 16:36:36 GMT+02:00 2001
void touch()
res.writeln(session.lastActive); Fri Jul 12 14:40:20 CEST 2002 session.touch(); res.writeln(session.lastActive); Fri Jul 12 14:55:20 CEST 2002
| SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods |