Passwords
[username] tag
Example WebDNA code:
[showif [username]!MyLogin]
[authenticate user]
[/showif]
[showif [password]!MyPassword]
[authenticate password]
[/showif]
This will display the browser's regular login dialog box unless the last Realm was MyLogin:MyPassword[password] tag
Example WebDNA code:
[showif [username]!MyLogin]
[authenticate user]
[/showif]
[showif [password]!MyPassword]
[authenticate password]
[/showif]
This will display the browser's regular login dialog box unless the last Realm was MyLogin:MyPassword[protect] tag
Parameters
Parameter | Description |
---|---|
group name | A user group name must be present in the [protect group1,group2] tag. If more than one group is allowed, then used a comma delimited list. |
Users may be added to the Users.db in the WebDNA administration area, under the Security section. The Admin group has built-in privileges to access the site's WebDNA preferences, so create new groups other than admin for use within a web site. Only use the group admin for users authorised to configure the site's WebDNA settings.T here is no special "create group" button in WebDNA admin, a group can be created in the group text area when creating a user.
Example WebDNA code:
[protect admin,developers]
This will only allow members of the admin and the developers groups to access the pages if they authenticate correctly.Working with groups example WebDNA code:
Using the [protect groups] tag with multiple groups, but each group is to be delivered different content:
[protect group1,group2]
[search db=Users.db&eqUSERdatarq=[uppercase][username][/uppercase]&eqPASSdatarq=[url][encrypt][uppercase][password][/uppercase][/encrypt][/url]]
[founditems]
[text]varGROUP=[groups][/text]
[/founditems]
[/search]
[showif [varGROUP]=group1]Content for GROUP1[/showif]
[showif [varGROUP]=group2]Content for GROUP2[/showif]
Or another method used to hide content from one of the groups
[search db=Users.db&GROUPSword=ww&woGROUPSdatarq=[uppercase]group1[/uppercase]&eqUSERdatarq=[uppercase][username][/uppercase]&eqPASSdatarq=[url][encrypt][uppercase][password][/uppercase][/encrypt][/url]]
[showif [numfound]=0]
Content hidden from GROUP1
[/showif]
[/search]
After users with groups are created, use the [protect groups] tag on any page. When using mulitiple groups, using [protect group2,admin], this gives a group2 member authority to access the protected page, it also gives any member of admin the same access, but it does NOT confer admin status to anyone in group2.
Be careful how groups are named. The code that checks the User.db looks for whole words to match the group. If groups are named in someway that could be misconstrued as two separate words, such as ABC_GROUP1, ABC_GROUP2 and group ABC also exists, then the first two will be seen by WebDNA as belonging to ABC, because the underscore is read as a delimiter.
Other problematic delimiters are dashes, spaces and periods.
The difference between [protect] and [authenticate] tags is that the [protect] is directly associated with WebDNA's Users.db, whereas the [authenticate] tag is for developers who prefer to create their own user system, such as a database with more extensive fields and functionality than the simple Users.db.
Directory Protection
Directories cannot be protected with WebDNA, because the webserver does not return any processing data to WebDNA if a directory listing is requested, so something such as a directory of images can not be protected. In this instance control with an .htpasswords file, or realm protection on a server level is required.
[authenticate] tag
Basically, this is how it works:
The "MultiGroupChecker" checks
- if the [username] is in the Users.db
- if the [username] and [password] match in the Users.db
- if the [username] is allowed access to the specified group in the [protect groups] tag
- if the [username] has expired