G.L.3
G.L.3

Reputation: 83

Meteor: accounts-ui Package

I want to use accounts-ui package for manage accounts on my application, but it's currently a drop-down sign-in form. Does anyone know how to wrap it in a button so that when I click a button, the accounts log-in page will render?

Upvotes: 2

Views: 194

Answers (1)

Matthias A. Eckhart
Matthias A. Eckhart

Reputation: 5156

As sdybskiy already pointed out in the comments, the Meteor accounts-ui package is limited to the drop-down form. However, you could use the User Accounts suite to include UI templates for the Meteor's accounts module.

Currently, the following versions are available:

If you want install the accounts suite, you just need to run:

  1. meteor add useraccounts:<version>, for example: useraccounts:bootstrap.
  2. meteor add accounts-<loginService>, for example: accounts-password.

Concerning routing, there are also two add ons available, useraccounts:iron-routing and useraccounts:flow-routing.

So, if you want to have a button which renders the login page on click, you could use the following code example as a starting point (assuming you are using Iron-Router and the useraccounts:iron-routing package):

<template name="home">
   <button id="login" type="button" class="btn btn-default">Login</button>
</template>

Template.home.events({ 
  'click #login': function (event) {
   event.preventDefault();
   Router.go('/login');
});

AccountsTemplates.configureRoute('signIn', {
    name: 'signin',
    path: '/login',
    template: 'myLogin',
    layoutTemplate: 'myLayout',
    redirect: '/user-profile',
});

Upvotes: 1

Related Questions