Verifying the User's Email Address

When the email verification is enabled and an account is registered with an email address, Kii Cloud will send a verification email to the user with a verification link. Logging in with the specified email address will only be allowed if the user previously clicked on the verification link. When the email verification is finished, Kii Cloud will notify the completion via another email.

The email verification is also launched when it is enabled and a user modifies their email address. Logging in with the new email address will be allowed after the user clicks a link in the verification email. When the verification is finished, the user will be notified with another email. The old email will be invalidated at this time. You can use the KiiUser#getPendingEmailAddress() method to check the old (pending) email address.

Enabling the verification

You can enable or disable the verification in the developer portal. For more information, see Toggle the verifciations.

By default, the verification feature is turned off.

Setting the redirection URLs

You can specify web pages where users are redirected when they click the link in the verification email.

You can change the rediction URL on the developer portal. See Setting the redirection URL to learn more.

Setting custom email templates

You can customize the content of the verification and completion emails by setting the templates. The templates can be set per user locale.

You can customize the email templates on the developer portal. See Customizing the verification email to learn more.

Please also check the sample code for setting the user locale in Localizing the Email Templates.

Resending the verification email

The verification email will be sent automatically to the user when the user registration and the user attribute modification are made.

You can also request to resend the verification email. As shown in the sample code below, execute the resendEmailVerification method while the user is logged-in to request the resend of the verification email (for more details on the getCurrentUser method, see Getting the Current User).

  • // Get the currently logged-in user.
    var user = KiiUser.getCurrentUser();
    
    // Resend a verification mail.
    user.resendEmailVerification().then(
      function(theUser) {
        // Do something.
      }
    ).catch(
      function(error) {
        // Handle the error.
        var theUser = error.target;
        var errorString = error.message;
      }
    );
  • // Get the currently logged-in user.
    var user = KiiUser.getCurrentUser();
    
    // Resend a verification mail.
    user.resendEmailVerification({
      success: function(theUser) {
        // Do something.
      },
      failure: function(theUser, errorString) {
        // Handle the error.
      }
    });