(API) LoginPrompt

  • plamzi
  • plamzi's Avatar Topic Author
  • Offline
  • Administrator
17 Nov 2013 18:20 - 01 Dec 2014 19:13 #1 by plamzi
(API) LoginPrompt was created by plamzi

This plugin uses Modal, and supports all the methods of its parent plugin, including custom buttons and links. It creates a flexible login prompt for entering a username or character name and logging the user in.

You can define a login prompt entirely on the client side by using regular expressions. You can also control login entirely from the server, using GMCP / JSON packages.

Note: Having a login prompt will still let users set up triggers for auto-login (assuming that the server sends the strings their triggers need). The prompt will appear and disappear automatically if it is set up correctly.

Note: The LoginPrompt in the screenshot is for a Havoc -engine game, and shows a Login via Facebook option (as well as reset password support via custom links). It is possible to add these features to your game even if it doesn't use Havoc, but you'll need some custom code on both the client and server side.


placeholderThe text of the hint for the first input field. Example: 'username' or 'character name'
showA Regular Expression that will trigger the prompt to show. The global match of this regular expression will be displayed as the title of the login prompt.
errorA Regular Expression that will trigger the prompt to display the matching text inside an error note. It should catch any phrases the server sends on invalid authentication.
passwordA Regular Expression that will trigger the sending of the password. This is required for the proper working of the login flow.
dismissA Regular Expression that will trigger the prompt to disappear. This can be a unique phrase or a set of phrases that are shown to users on successful login.
any Modal optionOptions that will be passed to the underlying Modal Dialog .


Client-side implementation:
Config.LoginPrompt = new LoginPrompt({
    placeholder: 'username',
    show: '.*Enter new or existing username:',
    error: '.*(Username is invalid|Invalid name|Invalid password).*',
    password: 'Password:',
    dismiss: '(By what name|Reconnecting|like to create this account|Wrong password)',
    backdrop: 'static'

Server-side implementation:
LoginPrompt {
	title: "Please enter your username:",
	placeholder: "username",
	error: "Invalid password",
	links: {
		'Reset password': 'reset',
		'Enter token': 'token'
	backdrop: 'static'
Last edit: 01 Dec 2014 19:13 by plamzi.
The topic has been locked.