User registration: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Sarah (talk | contribs)
Instructions for registering users
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
To sign a user up for your app, you'll need to get an email address and a password from them and send it to Volt. If enabled, Volt will send a [[user_confirmation|confirmation]] email. Once the user registers, they will be able to [[log_in|sign on to your app]].
To sign a user up for your app, you'll need to get an email address and a password from them and send it to VoltServer. If enabled, VoltServer will send a [[user_confirmation|confirmation]] email. Once the user registers, they will be able to [[log_in|sign on to your app]].


== Registering a User ==
== Registering a User ==
Line 7: Line 7:
[[File:Registering-a-user.png]]
[[File:Registering-a-user.png]]


Once you've collected the data, you can call Volt using <code>$volt.auth.register()</code> function to register. This will create an account.
Once you've collected the data, you can call VoltServer using <code>$volt.auth.register()</code> function to register. This will create an account.


The syntax of the function is:
The syntax of the function is:
Line 16: Line 16:
* ''password'' - string, required. The user's password.
* ''password'' - string, required. The user's password.
* ''confirmation'' - string, required. The confirmation password. Must match.
* ''confirmation'' - string, required. The confirmation password. Must match.
* ''appId'' - string, optional. The Volt ID of the app to sign into. If not supplied, defaults to value set in <code>$volt.init(appId)</code>.
* ''appId'' - string, optional. The VoltServer ID of the app to sign into. If not supplied, defaults to value set in <code>$volt.init(appId)</code>.
* ''callback'' - function(error, data), required. The function in your app to call when the register is complete (or fails).
* ''callback'' - function(error, data), required. The function in your app to call when the register is complete (or fails).


After Volt receives the registration, it will send a [[user_confirmation|confirmation email]] if you have enabled that functionality.
After VoltServer receives the registration, it will send a [[user_confirmation|confirmation email]] if you have enabled that functionality.


   <syntaxhighlight lang="JavaScript">
   <syntaxhighlight lang="JavaScript">

Latest revision as of 15:27, 25 February 2021

To sign a user up for your app, you'll need to get an email address and a password from them and send it to VoltServer. If enabled, VoltServer will send a confirmation email. Once the user registers, they will be able to sign on to your app.

Registering a User

Here's a typical user registration screen:

Once you've collected the data, you can call VoltServer using $volt.auth.register() function to register. This will create an account.

The syntax of the function is:

$volt.auth.register(email, password, confirmation, appId, callback)

  • email - string, required. The email address of the user.
  • password - string, required. The user's password.
  • confirmation - string, required. The confirmation password. Must match.
  • appId - string, optional. The VoltServer ID of the app to sign into. If not supplied, defaults to value set in $volt.init(appId).
  • callback - function(error, data), required. The function in your app to call when the register is complete (or fails).

After VoltServer receives the registration, it will send a confirmation email if you have enabled that functionality.

  butCreateAccount.onclick = function () {
    $volt.auth.register(inpEmail.value, inpPassword.value, inpPasswordConfirm.value, createAccountCallback);
  }

  function createAccountCallback(error, data) {
    if (error) {
      if (!data) {
        data = { message: 'Network Error' };
      }
      alert(data.message);
    } else {
      alert('Your account has been registered.');
    }
  }
  Function butCreateAccount_onclick() 
    $volt.auth.register(inpEmail.value, inpPassword.value, inpPasswordConfirm.value, createAccountCallback)
  End Function

  Function createAccountCallback(error, data) {
    If error Then
      If (!data) Then data = { message: "Network Error" }
      MsgBox data.message
    Else
      MsgBox "Your account has been registered."
    End If
  End Function

AppStudio Users

AppStudio includes a form called frmSignOn. If you include it in your app, a register form is included. To use it, do the following:

  showCreateAccount();
  showCreateAccount()

Reference