How to register users to your intervention so that they can log in and out

From Lifeguide Wiki
Jump to: navigation, search

Registration and login

It is likely that your intervention will need a registration page to allow end-users to sign up for an intervention.

Getting your end-users to register for an intervention is highly recommended if:

  • It is anticipated that they will be using your intervention more than once. This allows:
    • all instances of using the intervention to be recorded against the same person
    • you to save data from the end-user in previous sessions to be shown or used in later sessions
    • end-user’s information to stay secure.
  • You will be collecting data from your intervention (interventions that do not get the person to register records all users as ‘anon’)
  • Collecting an e-mail address or mobile number during the registration process will allow you to send text or email messages to the end-user.


The Registration Page

The registration page will need to include an option to enter:

  1. An email address or other user identifier. An email address is preferred because people tend to forget a username that isn't their email address!
  2. A password (These two pieces of information (1 and 2) will be used together to create the user account in the logic of the intervention (more info below))
  3. Any other information that you may want them to enter (e.g. a box to tick to say they agree to take part in the study, e-mail address or phone number for sending automated messages, etc.).

A username or e-mail address

In order to create a new user account, it is necessary to have a unique username for each user. This username can be an email address, or it can be a sequence of alphanumeric characters (i.e. letters and numbers, but no spaces or special characters).

This information can be collected using text entry interactions.

We recommend asking end-users to enter their email address as a username rather than a user identifier (such as their name, nickname, etc.).

Error messages can be used to make end-users enter a username before moving onto the next page.

A password

Passwords are entered using text entry interactions that have been set to password format.

The stronger the password that the end-user enters the more secure their data will be. You might, therefore, want to advise your end-users to choose a password that is at least eight characters long, includes alpha and numeric characters, contains both capital and lowercase letters and does not include their name/username.

Error messages can be used to make end-users enter a password before moving onto the next page

The Login Page

You will need to create a login page to allow end-users to log back in with their username and password in any subsequent visits to the intervention.

You will only need to create one login page and will need to ask end-users to enter their username/email address and password into text-entry boxes.

If they have forgotten their password since the last time they logged in then you can allow your end-users to reset their passwords (see below).

Creating User Accounts: The logic

This section will introduce you to the following logic commands makenewuser and authenticateuser . The logic command set is also used to make sure that the person’s username can be used for further logic commands throughout the rest of the intervention.

The following is a breakdown of how the first lines of logic will probably look for your intervention.

set username to login.login_username

if (not (isempty (signup.signup_username))) set username to signup.signup_username

  • A person's username may be used throughout the logic for a number of different logic functions (e.g. setting up user accounts, saving things across sessions, verifying users are registered etc).
  • These first two lines of logic makes sure that the person's username is always taken from the right place. For example if the person is using the intervention after they have just registered you will need to take the username from the signup page. If they have logged back in the username will need to be taken from their login page. So the logic will set the variable 'username' to the interaction called 'username' on the 'login' page. However, if this interaction is empty it will move onto the next line of logic where it will take the username from the interaction on the signup page.

show welcome

  • Shows the first page of the intervention which is called welcome

show signup

  • Shows the signup page when the person selects the option on the welcome page.

after signup if (makenewuser(signup.signup_username, signup.signup_password)) goto thankyou

save signup for username

  • This is the registration process - the makenewuser command is used to set up an account for the user using a username and password

show thankyou

  • Shows the thankyou page

show login

  • If the person clicks the option to login instead of register they will go to the login page. This is because the login button on the welcome page is a jump button so it can jump to anyway in the logic instead of the next page.

after login if (authenticateuser (login.login_username, login.login_password)) goto loginthanks

  • This line of logic is used to check that a user already exists (i.e. that they have already registered for the intervention). This is extremely important logic as without this logic, functions such as saving information or setting up graphs will not work successfully. Note that this logic could be written into an error message on the page logic instead.

show loginfail

  • If the username does not exist or the password is incorrect, this page will show. If the correct account details are entered, this line will be ignored and the next page will show.

show loginthanks