This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
FormioAuth Provider
Randall Knutson edited this page Jul 27, 2016
·
10 revisions
.setForceAuth(bool);
Name | Type | Description |
---|---|---|
allowed | Boolean | Set to true if you would like the user to only have access to the login page until they are authenticated. Otherwise, set it to false. |
Example: FormioAuthProvider.setForceAuth(true);
.setStates(anonState, authState);
Name | Type | Description |
---|---|---|
anonState | String | The login state. Defaults to "login.auth". |
authState | String | The state the user is redirected to after login. Defaults to "home". |
Example: FormioAuthProvider.setStates('auth.login', 'home');
.register(name, resource, path);
Name | Type | Description |
---|---|---|
name | String | The name of your login template.
|
Example: FormioAuthProvider.register('login', 'user', 'login');
-
FormioAuthProvider - This allows you to register the authentication login pages and provide the authenticated and anonymous states.
.config(function(FormioAuthProvider) {
// Set the base url for formio.
FormioAuthProvider.setStates('auth.login', 'home');
FormioAuthProvider.setForceAuth(true);
FormioAuthProvider.register('userLogin', 'user', 'user/login');
FormioAuthProvider.register('customerLogin', 'customer', 'customer/login');
```
-
FormioAuth - You need to run the init() method in order to initialize all of the authentications.
.run(function(FormioAuth) {
// Initialize the Form.io authentication provider.
FormioAuth.init();
```