forio Toggle navigation

Password Service

The primary use-case for the Password Service is to allow end-users to reset their passwords.

Constructor options

Required? Name Type Description
  account string The account id. In the Epicenter UI, this is the Team ID (for team projects) or User ID (for personal projects). Defaults to undefined. If left undefined, taken from the URL.
  project string The project id. Defaults to undefined. If left undefined, parsed from the URL.
  token string For projects that require authentication, pass in the user access token (defaults to undefined). If the user is already logged in to Epicenter, the user access token is already set in a cookie and automatically loaded from there. (See more background on access tokens). @see Authentication API Service for getting tokens.
  transport JQueryAjaxOptions Options to pass on to the underlying transport layer. All jquery.ajax options are supported.
  server object
  server.host string The value of host is usually the string api.forio.com, the URI of the Forio API server. This is automatically set, but you can pass it explicitly if desired. It is most commonly used for clarity when you are hosting an Epicenter project on your own server
  server.protocol https / http Defaults to https

Methods

resetPassword(userName[, resetParams, options])

Send a password reset email for the provided userName.

Parameters

Required? Name Type Description
Yes userName string user to reset password for
  resetParams object
  resetParams.redirectUrl string URL to redirect to after password is reset. Defaults to project root. If relative, it's treated as being relative to project
  resetParams.subject string Subject for reset password email
  resetParams.projectFullName string Text to use within body. Text will be of the form `You have requested a password reset for the user {userName} in {projectFullName}.
  options object overrides for service options

Example

var ps = new F.service.Password();
            ps.resetPassword('myuserName@gmail.com', {
                redirectUrl: 'login.html',
                subject: 'Please reset your password',
                projectFullName: 'My Awesome Project'
            });

This will send the following email

Subject: Please reset your password
To: myuserName@gmail.com
From: support@forio.com
Body:
You have requested a password reset for the user endUser@acmesimulations.com in My Awesome Project. 

If you did not initiate this request, please ignore this email.

To reset your password, please click the following link: https://forio.com/epicenter/recover/<password recovery token>