====== Logon ======
The configured Logon Module is executed for every [[server:Terminal]] Server logon (excluding QWKnet logons).

The name of the logon module (by default, ''logon'') is configured in [[util:SCFG]]->System->Loadable Modules->Logon.

The [[https://gitlab.synchro.net/main/sbbs/-/blob/master/exec/logon.js|default logon module]] is ''[[dir:exec]]/logon.js'' and supports the following configuration options in the ''[logon]'' section of the ''[[dir:ctrl]]/[[config:modopts.ini]]'' file:

^ Option ^ Default ^ Description ^
| show_avatar       | true  | Show the user's avatar during logon               |
| draw_avatar_above | false | Draw the avatar above the current cursor position (requires ''show_avatar=true'') |
| draw_avatar_right | true  | Draw the avatar on right edge of the screen (requires ''show_avatar=true'') |
| set_avatar        | false | Prompt the user to choose their avatar if they don't have one |
| rlogin_auto_xtrn  | false | Auto-execute an external program when the RLogin 'terminal-type' includes ''xtrn=//<code>//''|
| rlogin_xtrn_menu  | false | RLogin server acts as a door game server (displays the external program menu or a section menu) //only// |
| rlogin_xtrn_logon | true  | Display logon screens, execute logon events, display last few callers and auto-message during RLogin logons |
| rlogin_xtrn_logoff | false | Prompt for log-off (instead of just disconnecting) when exiting external program menu ("full" is another possible value) |
| show_logon_list   | true  | Set to ''false'' to disable the display of the logon list ("last few callers") during logon |
| email_validation  | false | Run the [[module:emailval]] (user e-mail address validation) module during logon |
| fast_logon        | false | When ''true'', allows users to choose a fast-logon by adding ''!'' in front of their login name/number |
| fast_logon_requirements | //none// | An [[access:requirements|access requirements string]] that specifies a subset of users which may use the fast-logon option |
| eval_first        | //none// | JavaScript expression to evaluate (execute) very early in the module |
| eval_last         | //none// | JavaScript expression to evaluate (execute) last thing in the module |
| sysop_available   | ''text.dat'' LiSysopAvailable string | Comma-separated list of random sysop-is-available-for-chat status strings (displayed during logon) |
| sysop_unavailable | ''text.dat'' LiSysopNotAvailable string | Comma-separated list of random sysop-is-not-available-for-chat status strings (displayed during logon) |
| guest_name        | default-text (see ''logon.js'') | Prompt for the real/full name of //Guests// during logon, set to false to disable or set to alternate prompt text string |
| guest_email       | default-text (see ''logon.js'') | Prompt for the email address of //Guests//, set to false to disable (recommended to leave enabled) |
| guest_location    | default-text (see ''logon.js'') | Prompt for the location of //Guests//, set to false to disable |
| guest_referral    | default-text (see ''logon.js'') | Prompt //Guests// to provide an answer to question: "Where did you hear about this BBS?", set to false to disable |

===== Fast Logon =====

The logon module supports a //fast-logon// mode which bypasses the display of logon menus and the execution of interactive user logon events.

The JavaScript variable ''bbs.sys_status'' has a bit-flag, ''SS_FASTLOGON'', which is used by the logon module to determine whether a fast-logon was requested by the user. 

The default [[module:login]] module recognizes a prepended ''!'' character on the user's login ID (name, alias, or number) as an indicator that fast logon mode was requested by the user.

===== Customize =====

If you choose to use a customized or entirely different logon module, it is recommended that you use a different module name (not "logon") and/or copy the stock logon module to your ''[[dir:mods]]'' directory before modifying.

===== RLogin =====

The RLogin protocol is often used for "door game server" functionality for its simplicity and the automated-login capability (a username and password may be passed from the client to the server during initial connection, automatically).

A couple of options are supported by the logon module to support this functionality:

==== rlogin_auto_xtrn  ====
When this option is enabled and the Rlogin "terminal" field provided by the RLogin client begins with the characters "xtrn=", the value following the equals sign is interpreted to be the //internal code// of an external program (as configured in [[util:SCFG]]->External Programs->Online Programs) to immediately execute. The user's connection is terminated after execution.

==== rlogin_xtrn_menu ====
When this option is enabled, all RLogin connections that do **not** result in the immediate execution of an external program (see above), are limited to just the external program section menu where the can then run one or more external programs based on their selections. Upon quitting/exiting the external program section, the user is disconnected.

To automatically direct a user to a particular external program //section//, the RLogin client can pass a "terminal" field value of "xtrn_sec=<code>" where ''<code>'' is the //internal code// of the external program section.

=== rlogin_xtrn_logon ===
When ''rlogin_xtrn_menu'' is enabled, setting ''rlogin_xtrn_logon'' to ''false'' will cause the normal logon procedures (i.e. logon screens, logon list, auto-message) to be skipped for RLogin sessions.

=== rlogin_xtrn_logoff ===
When ''rlogin_xtrn_menu'' is enabled, setting ''rlogin_xtrn_logoff'' to ''true'' will enable a prompt for log-off upon exiting the external program menu and require positive confirmation from the user before disconnecting, rather than just immediately disconnecting the user when quitting the external program menu. Setting ''rlogin_xtrn_logoff'' to ''full'' will both prompt and if affirmed by the user, initiate the normal/full user log-off procedure (i.e. displaying log-off screens and executing log-off events) before disconnecting the user.

===== See Also =====
  * [[:module:|Modules]]
  * [[:module:Login]] Module
  * [[:dir:exec]] Directory
  * [[:dir:mods]] Directory

