Portal Manager
PortalManager allows you to create custom login, sign-up pages and create, enable, or disable new portal users.
Methods
| Method | Arguments | Comments |
|---|
| CreatePortalUser | User user, string password (optional), bool sendNotification (optional), string accountId (optional) | This method will create a new User and a new Contact record.
Populate the user info and optionally create a password. If no password is passed, the user will set a temporary password and will go through password reset after login.
sendNotification flag by default is true. Using this flag you can control whether the activation email should be sent or not.
Optionally pass an accountId to which the new Contact record will be linked to. Otherwise the default Bulk Account Id will be used.
|
| CreatePortalUser | Contact contact, string username, string password (optional), string roleId (optional) | Using this method you can enable an existing Contact record as a Portal User.
username is required and has to be a unique value.
Optionally pass password. If no password is passed, the user will set a temp password and will go through a password reset after login.
A roleId can be optionally passed and the new user will assume the passed role. Otherwise the Default Role set in the Custom Portal will be used. If the contact passed to the method is an existing contact, an activation email will be sent to the contact's email address. Otherwise, a user and contact will be created. |
| Login | string username, string password, string returnUrl, bool remember (optional) | Logs in the portal user.
Returns an ActionResponse you can use in your Custom Controller. |
| ForgotPassword | string username | |
| CheckUserStatus | Contact contact | Returns PortalUserInfo object, which provides info about the current status of the Contact record.
ContactId, UserId and IsActive
If UserId is null, then the contact does not have a user record associated to it. |
| EnablePortalUser | PortalUserInfo userInfo, bool enabled | Enables or disables a portal user. |
| CreateAuthToken | string userId
double expiresInMinutes = 4320 | Default value is set to 72 hours |
| SendActivation | User user | Returns a boolean value to indicate if the operation was successful. This method will set a new password for the user and send a new activation email. |
| SendUserActivationEmail | User user
optional parameter: string emailTemplateId | Sends an activation email to the given user.
You can optionally use a custom email template for the activation process.
|
The below example sends an activation email to a user with an alternative email template:
PortalManager.SendUserActivationEmail(user, emailTemplateId: "<your_id>")