GithubHelp home page GithubHelp logo

studiointeract / accounts-ui Goto Github PK

View Code? Open in Web Editor NEW
196.0 12.0 81.0 289 KB

Accounts UI for React in Meteor 1.3+

License: MIT License

JavaScript 100.00%
meteor react flow-router react-router loginform ssr signup profile

accounts-ui's Introduction

React Accounts UI

Current version 1.3.0

Features

  1. Easy to use, mixing the ideas of useraccounts configuration and accounts-ui that everyone already knows and loves.
  2. Components are everywhere, and extensible by replacing them on Accounts.ui.
  3. Basic routing included, redirections when the user clicks a link in an email or when signing in or out.
  4. Unstyled is the default, no CSS included.
  5. No password sign up and sign in are included.
  6. Extra fields is now supported.
  7. Extending to make your own custom form, for your app, or as a package, all components can be extended and customized.
  8. States API makes it possible to use the form on different routes, say you want the login on one route and signup on another, just set the inital state and the links (either globally or per component by using the props).
  9. React Router is fully supported, see the example how to use with React Router.
  10. FlowRouter is fully supported, see the example how to use with FlowRouter.
  11. Server Side Rendering is easily setup, see how it's done with FlowRouter (SSR). An example for React Router using react-router-ssr coming shortly.

Styling

This package does not by standard come with any styling, you can easily extend and make your own, here are a couple versions we've made for the typical use case:

Installation

meteor add std:accounts-ui

Configuration

We support the standard configuration in the account-ui package. But have extended with some new options.

Accounts.ui.config(options)

import { Accounts } from 'meteor/std:accounts-ui'

Configure the behavior of <Accounts.ui.LoginForm />

Example configuration:

Accounts.config({
  sendVerificationEmail: true,
  forbidClientAccountCreation: false
});

Accounts.ui.config({
  passwordSignupFields: 'EMAIL_ONLY',
  loginPath: '/login',
  signUpPath: '/signup',
  resetPasswordPath: '/reset-password',
  profilePath: '/profile',
  onSignedInHook: () => FlowRouter.go('/general'),
  onSignedOutHook: () => FlowRouter.go('/login'),
  minimumPasswordLength: 6
});

Version 1.2 also supports passing hooks through props to the component.

import { Accounts } from 'meteor/std:accounts-ui';

<Accounts.ui.LoginForm
  onSignedInHook={ () => console.log('user signed in') }
/>

Options:

  • requestPermissions    Object
    Which permissions to request from the user for each external service.

  • requestOfflineToken    Object
    To ask the user for permission to act on their behalf when offline, map the relevant external service to true. Currently only supported with Google. See Meteor.loginWithExternalService for more details.

  • forceApprovalPrompt    Boolean
    If true, forces the user to approve the app's permissions, even if previously approved. Currently only supported with Google.

  • passwordSignupFields    String
    Which fields to display in the user creation form. One of 'USERNAME_AND_EMAIL', 'USERNAME_AND_OPTIONAL_EMAIL', 'USERNAME_ONLY', 'EMAIL_ONLY', 'USERNAME_AND_EMAIL_NO_PASSWORD', 'EMAIL_ONLY_NO_PASSWORD' (default).

  • requireEmailVerification    Boolean
    Set if the login without password should check if the user is verified before sending any login emails. Default is false.

  • minimumPasswordLength    Number
    Set the minimum number of password length for your application. Default is 7.

  • homeRoutePath    String
    Set the path to where you would like the user to be redirected after a successful login or sign out.

  • loginPath    String
    Change the default path a user should be redirected to after a clicking a link in a mail provided to them from the accounts system, it could be a mail set to them when they have reset their password, verifying their email if the setting for sendVerificationEmail is turned on (read more on accounts configuration ). Can also be set as a property to the LoginForm, for i18n routes or other customization.

  • signUpPath    String
    Set the path to where you would like the sign up links to link to rather than changing the state on the current page. Can also be set as a property to the LoginForm, for i18n routes or other customization.

  • resetPasswordPath    String
    Set the path to where you would like the link to reset password to go to rather than changing the state on the current page. Can also be set as a property to the LoginForm, for i18n routes or other customization.

  • profilePath    String
    Set the path to where you would like the link to the profile to go to rather than changing the state on the current page. Can also be set as a property to the LoginForm, for i18n routes or other customization.

  • changePasswordPath    String
    Set the path to where you would like the link to change password to go to rather than changing the state on the current page. Can also be set as a property to the LoginForm, for i18n routes or other customization.

  • onSubmitHook    function(error, state)
    Called when the LoginForm is being submitted: allows for custom actions to be taken on form submission. error contains possible errors occurred during the submission process, state specifies the LoginForm internal state from which the submission was triggered. A nice use case might be closing the modal or side-menu or dropdown showing LoginForm. You can get all the possible states by import STATES from this package.

  • onPreSignUpHook    function(options)
    Called just before submitting the LoginForm for sign-up: allows for custom actions on the data being submitted. A nice use could be extending the user profile object accessing options.profile. to be taken on form submission. The plain text password is also provided for any reasonable use. If you return a promise, the submission will wait until you resolve it.

  • onPostSignUpHook    func(options, user)
    Called client side, just after a successful user account creation, post submitting the form for sign-up: allows for custom actions on the data being submitted after we are sure a new user was successfully created.

  • onResetPasswordHook    function()
    Change the default redirect behavior when the user clicks the link to reset their email sent from the system, i.e. you want a custom path for the reset password form. Default is loginPath.

  • onEnrollAccountHook    function()
    Change the default redirect behavior when the user clicks the link to enroll for an account sent from the system, i.e. you want a custom path for the enrollment form. Learn more about how to send enrollment emails. Default is loginPath.

  • onVerifyEmailHook    function()
    Change the default redirect behavior when the user clicks the link to verify their email sent from the system, i.e. you want a custom path after the user verifies their email or login with EMAIL_ONLY_NO_PASSWORD. Default is profilePath.

  • onSignedInHook    function()
    Change the default redirect behavior when the user successfully login to your application, i.e. you want a custom path for the reset password form. Default is profilePath.

  • onSignedOutHook    function()
    Change the default redirect behavior when the user signs out using the LoginForm, i.e. you want a custom path after the user signs out. Default is homeRoutePath.

  • emailPattern    new RegExp()
    Change how emails are validated on the client, i.e. require specific domain or pattern for an email. Default is new RegExp('[^@]+@[^@\.]{2,}.[^\.@]+').

No password required

This package provides a state that makes it possible to create and manage accounts without a password. The idea is simple, you always verify your email, so to login you enter your mail and the system emails you a link to login. The mail that is sent can be changed if needed, just how you alter the email templates in accounts-base.

This is the default setting for passwordSignupFields in the configuration.

Using React Accounts UI

Example setup (Meteor 1.3)

meteor add accounts-password
meteor add std:accounts-ui

import React from 'react';
import { Accounts } from 'meteor/std:accounts-ui';

Accounts.ui.config({
  passwordSignupFields: 'EMAIL_ONLY_NO_PASSWORD',
  loginPath: '/',
});

if (Meteor.isClient) {
  ReactDOM.render(<Accounts.ui.LoginForm />, document.body)
}

Example setup using React Router (Meteor 1.3)

Following the Application Structure from the Meteor Guide.

npm i --save react react-dom react-router
meteor add accounts-password
meteor add std:accounts-ui

import React from 'react';
import { render } from 'react-dom';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
import { Accounts, STATES } from 'meteor/std:accounts-ui';

import { App } from '../../ui/layouts/app.jsx';
import { Index } from '../../ui/components/index.jsx';

import { Hello } from '../../ui/pages/hello.jsx';
import { Admin } from '../../ui/pages/admin.jsx';
import { NotFound } from '../../ui/pages/not-found.jsx';

Meteor.startup( () => {
  render(
    <Router history={ browserHistory }>
      <Route path="/" component={ App }>
        <IndexRoute component={ Index } />
        <Route path="/signin" component={() => <Accounts.ui.LoginForm />} />
        <Route path="/signup" component={() => <Accounts.ui.LoginForm formState={STATES.SIGN_UP} />} />
        <Route path="/hello/:name" component={ Hello } />
      </Route>
      <Route path="/admin" component={ App }>
        <IndexRoute component={ Admin } />
      </Route>
      <Route path="*" component={ NotFound } />
    </Router>,
    document.getElementById( 'react-root' )
  );
});

You can learn more about the remaining components here in the tutorial on React Router Basics by the Meteor Chef.

Example setup using FlowRouter (Meteor 1.3)

npm i --save react react-dom meteor add accounts-password
meteor add std:accounts-ui
meteor add kadira:flow-router-ssr

import React from 'react';
import { Accounts } from 'meteor/std:accounts-ui';
import { FlowRouter } from 'meteor/kadira:flow-router-ssr';

Accounts.ui.config({
  passwordSignupFields: 'EMAIL_ONLY_NO_PASSWORD',
  loginPath: '/login',
  onSignedInHook: () => FlowRouter.go('/general'),
  onSignedOutHook: () => FlowRouter.go('/')
});

FlowRouter.route("/login", {
  action(params) {
    mount(MainLayout, {
      content: <Accounts.ui.LoginForm />
    });
  }
});

Example setup using the STATES api.

You can define the inital state you want in your route for the component, as set the path where the links in the component link to, for example below we have one route for /login and one for /signup.

meteor add accounts-password
meteor add std:accounts-ui
meteor add softwarerero:accounts-t9n
meteor add kadira:flow-router-ssr

import React from 'react';
import { Accounts, STATES } from 'meteor/std:accounts-ui';
import { T9n } from 'meteor/softwarerero:accounts-t9n';

T9n.setLanguage('en');

Accounts.config({
  sendVerificationEmail: true,
  forbidClientAccountCreation: false
});

Accounts.ui.config({
  passwordSignupFields: 'USERNAME_AND_OPTIONAL_EMAIL',
  loginPath: '/login'
});

FlowRouter.route("/login", {
  action(params) {
    mount(MainLayout, {
      content: <Accounts.ui.LoginForm {...{
        signUpPath: '/signup'
      }} />
    });
  }
});

FlowRouter.route("/signup", {
  action(params) {
    mount(MainLayout, {
      content: <Accounts.ui.LoginForm {...{
        formState: STATES.SIGN_UP,
        loginPath: '/login'
      }} />
    });
  }
});

Create your own styled version

To you who are a package author, its easy to write extensions for std:accounts-ui by importing and export like the following example:

// package.js

Package.describe({
  name: 'author:accounts-bootstrap',
  version: '1.0.0',
  summary: 'Bootstrap – Accounts UI for React in Meteor 1.3',
  git: 'https://github.com/author/accounts-bootstrap',
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.3');
  api.use('ecmascript');
  api.use('std:accounts-ui');

  api.imply('session');

  api.mainModule('main.jsx');
});
// package.json

{
  "name": "accounts-bootstrap",
  "description": "Bootstrap – Accounts UI for React in Meteor 1.3",
  "repository": {
    "type": "git",
    "url": "https://github.com/author/accounts-bootstrap.git"
  },
  "keywords": [
    "react",
    "meteor",
    "accounts",
    "tracker"
  ],
  "author": "author",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/author/accounts-bootstrap/issues"
  },
  "homepage": "https://github.com/author/accounts-bootstrap",
  "dependencies": {
    "react": "^15.x",
    "react-dom": "^15.x",
    "tracker-component": "^1.3.13"
  }
}

To install the dependencies added in your package.json run:
npm i

// main.jsx

import React from 'react';
import PropTypes from 'prop-types';
import { Accounts, STATES } from 'meteor/std:accounts-ui';

/**
 * Form.propTypes = {
 *   fields: PropTypes.object.isRequired,
 *   buttons: PropTypes.object.isRequired,
 *   error: PropTypes.string,
 *   ready: PropTypes.bool
 * };
 */
class Form extends Accounts.ui.Form {
  render() {
    const { fields, buttons, error, message, ready = true} = this.props;
    return (
      <form className={ready ? "ready" : null} onSubmit={ evt => evt.preventDefault() } className="accounts-ui">
        <Accounts.ui.Fields fields={ fields } />
        <Accounts.ui.Buttons buttons={ buttons } />
        <Accounts.ui.FormMessage message={ message } />
      </form>
    );
  }
}

class Buttons extends Accounts.ui.Buttons {}
class Button extends Accounts.ui.Button {}
class Fields extends Accounts.ui.Fields {}
class Field extends Accounts.ui.Field {}
class FormMessage extends Accounts.ui.FormMessage {}
// Notice! Accounts.ui.LoginForm manages all state logic
// at the moment, so avoid overwriting this one, but have
// a look at it and learn how it works. And pull
// requests altering how that works are welcome.

// Alter provided default unstyled UI.
Accounts.ui.Form = Form;
Accounts.ui.Buttons = Buttons;
Accounts.ui.Button = Button;
Accounts.ui.Fields = Fields;
Accounts.ui.Field = Field;
Accounts.ui.FormMessage = FormMessage;

// Export the themed version.
export { Accounts, STATES };
export default Accounts;

Available components

  • Accounts.ui.LoginForm
    • Accounts.ui.Form
      • Accounts.ui.Fields
        • Accounts.ui.Field
      • Accounts.ui.Buttons
        • Accounts.ui.Button
      • Accounts.ui.FormMessage
      • Accounts.ui.PasswordOrService
      • Accounts.ui.SocialButtons

Extra fields

Example provided by @radzom.

import { Accounts, STATES } from 'meteor/std:accounts-ui';

class NewLogin extends Accounts.ui.LoginForm {
  fields() {
    const { formState } = this.state;
    if (formState == STATES.SIGN_UP) {
      return {
        firstname: {
          id: 'firstname',
          hint: 'Enter firstname',
          label: 'firstname',
          onChange: this.handleChange.bind(this, 'firstname')
        },
        ...super.fields()
      };
    }
    return super.fields();
  }

  translate(text) {
    // Here you specify your own translation function, e.g.
    return this.props.t(text);
  }

  signUp(options = {}) {
    const { firstname = null } = this.state;
    if (firstname !== null) {
      options.profile = Object.assign(options.profile || {}, {
        firstname: firstname
      });
    }
    super.signUp(options);
  }
}

And on the server you can store the extra fields like this:

import { Accounts } from 'meteor/accounts-base';

Accounts.onCreateUser(function (options, user) {
  user.profile = options.profile || {};
  user.roles = {};
  return user;
});

Deprecations

v1.2.11

  • The use of FormMessage in Form has been deprecated in favor of using FormMessages that handles multiple messages and errors. See example: Form.jsx#L43

  • Implementations of Accounts.ui.Field must render a message. See example: Field.jsx#L

Credits

Made by the creative folks at Studio Interact and all the wonderful people using and improving this package.

accounts-ui's People

Contributors

ahmad-safar avatar arthurpai avatar comus avatar denisgorbachev avatar elviron avatar gmanzato avatar h2s20 avatar jlouzado avatar josmo avatar jrtilson avatar lawrentiy avatar meteorplus avatar polguixe avatar premasagar avatar sachag avatar shoetten avatar teekennedy avatar timbrandin avatar todda00 avatar veeramarni avatar xavxyz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

accounts-ui's Issues

STUDIO INTERACT, PLEASE RESPOND. Need Docs on Social Buttons, Template Mods

I'm dead in the water with accounts for the past 3 days, waiting for a response to my previous post here.

I need to install social buttons. Is that possible? The Read.me doesn't say how to do it. How is this done?

I also need documentation on how to modify the components. Do I overwrite the ones included in the package? Wouldn't my mods be deleted when the package is updated? Please explain how this is done or provide a link that discusses how this is done.

Error messages

I think that we should add more error messages such as:

  • This email doesn't exist: sign in with unregistered email.
  • This email already exist: sign up with an already used email.
  • This password is incorrect: sign in with an incorrect password.

Are any hooks that can be used?

Accounts.sendLoginEmail does not work if address is set

If parameter 'address' is set email's 'to'-address will not be set:

'To' is set with variable 'email':
var options = { to: email, from: Accounts.em

But 'email' is only set when address is not set:
if (!address) { var email = _.find(user.emails || [], function (e) { return !e.verified; }); address = (email || {}).address; }

This case happens when configuring 'EMAIL_ONLY_NO_PASSWORD':
Accounts.ui.config({ passwordSignupFields: 'EMAIL_ONLY_NO_PASSWORD', ...

  • Did I miss something?
  • Please tell me if you'd like a pull request.

Problem when adding extra fields

I am following the documentation to add extra fields (firstname and lastname). It renders the fields as expected, but when filling the form it shows the following error:

underscore.js:102 Uncaught (in promise) RangeError: Maximum call stack size exceeded(…)

Removing the extra fields it works fine.
Any idea was this is happening.
Can someone show a working example adding extra fields (maybe I am missing something)

SocialButtons Don't Work?

I see that LoginForm has a SocialButtons element. How do I enable it so as to make it visible on the LoginForm?

How to extend for user profile

Hi great work you did already.
What I am missing is a way to ask user for firstname, lastname, etc... during signup and store these values in his profile.

I already figured out how to add the appropriate fields in the signup form like this

class NewLogin extends Accounts.ui.LoginForm {
    fields() {
        const { formState } = this.state;
        if (formState == STATES.SIGN_UP) {
            return { 
                firstname: {
                    id: 'firstname',
                    hint: 'Enter firstname',
                    label: 'firstname',
                    onChange: this.handleChange.bind(this, 'firstname')        
                },
                ...super.fields()
            };
        }
        return super.fields();
    }
}

But i cannot figure out how to get them into the options Object when calling the createUser method in line 451 of the LoginForm

Accounts.createUser(options, (error) => {

Can you give advice on it if possible at all or add a possibility for it.

Thx in advance

defaults for onResetPasswordHook and onEnrollAccountHook prevent showing correct form

The current default functions for onResetPasswordHook and onEnrollAccountHook redirect the form to the loginPath, which then changes the formState from PASSWORD_CHANGE to SIGN_IN and does not show the correct change password form.

In my project I set these hooks to blank functions to make these functions work, but this seems like a bad default.

Accounts.onCreateUser issue

You can only have a single callback hook on Accounts.onCreateUser, which leads to the following warning:

You've implemented Accounts.onCreateUser elsewhere in your application, you can therefor not use Accounts.ui.config({ onPostSignUpHook }) on the server.

What if instead of showing that warning, accounts-ui simply extended the current callback (available at Accounts._onCreateUserHook) with its own custom logic?

i.e.

Accounts.onCreateUser(() => {
  Accounts._onCreateUserHook();
  // do custom stuff here
}

Improvements for 3rd party services.

When only using 3rd party services, there are few things that could be improved. e.g.:

  • Not showing the Forget Password Button
  • Not showing the Login / Register Buttons

is it possible that you are mixing client and server code

Hi in the meteor docs

Accounts.ui.config is for client side
and
Accounts.onCreateUser for server side

I do not understand how or why are you mixing them with the postSignUpHook and think this is the cause why my app broke after upgrading to accounts-ui 1.1.5
I get the error

W20160402-23:59:43.756(2)? (STDERR) Error: Can only call onCreateUser once
W20160402-23:59:43.772(2)? (STDERR)     at AccountsServer.onCreateUser (packages/accounts-base/accounts_server.js:120:13)
W20160402-23:59:43.772(2)? (STDERR)     at exports.default (server/configs/accounts_setup.js:5:12)
W20160402-23:59:43.772(2)? (STDERR)     at meteorInstall.server.main.js (server/main.js:6:1)
...

Discussion: Invitation System

I am implementing an invitation system.

Are the current hooks in this package enough?

Basically I'll have to send a token, that will need to be validated, before creating the user.
After that the that user will need to be assigned to a specific role.

@SachaG and @timbrandin what do you think?

Do not use package.json if it's not a npm package!!!

When you use package.json with dependencies we have two copies of all your packages (one is my plus one is your). It's very bad!

It's crazy, but you use package.json for add of your sub-packages (bootstrap, etc.). Then we have three(!) copies of react, three copies of react-dom and three copies of tracker-component!

Add chinese language for China

China

zh_cn.js

T9n.map('zh_cn', {
  cancel: '取消',
  'Enter password': '输入密码',
  'Enter newPassword': '输入新密码',
  'Enter email': '输入电子邮箱',
  'Enter username': '输入用户名',
  'Enter username or email': '输入用户名或电子邮箱',
  error: {
    accounts: {
      'Invalid email or username': '无效的密码或用户名',
      'Internal server error': '内部服务器错误',
      'undefined': '服务未配置',
    },
  },
  'or use': '或是使用',
});

State is forced to PROFILE when user is logged in

the State for Accounts.ui.LoginForm is being set to PROFILE even when the formState prop is specified.

I wanted to have a route to show the Change Password form, so I specified a route as such:

FlowRouter.route('/change-password', {
    name: 'users.changePassword',
    action() {
      mount(MainLayoutCtx, {
        content: () => (<Accounts.ui.LoginForm {...{formState: STATES.PASSWORD_CHANGE}} />),
        h1: "Change Password"
      });
    }
  });

But because of this line, the state is being forced to PROFILE:
https://github.com/studiointeract/accounts-ui/blob/master/imports/ui/components/LoginForm.jsx#L33

It needs to be modified to have a default state of SIGN_IN when not signed in, and PROFILE when signed in, but use a specified formState prop if passed in. I will create a PR and link to this issue.

Examples give incorrect passwordSignupFields values

NO_PASSWORD is not a valid option according to your documentation yet examples use it and say it is the default.

Earlier in documentation (near top) it states that EMAIL_ONLY_NO_PASSWORD is the default.

and in code:

if (options.passwordSignupFields) {
    if (_.contains([
      "USERNAME_AND_EMAIL",
      "USERNAME_AND_OPTIONAL_EMAIL",
      "USERNAME_ONLY",
      "EMAIL_ONLY",
      "EMAIL_ONLY_NO_PASSWORD",
      "USERNAME_AND_EMAIL_NO_PASSWORD"
    ],

Add chinese language for Taiwan

Taiwan

zh_tw.js

T9n.map('zh_tw', {
  cancel: '取消',
  'Enter password': '輸入密碼',
  'Enter newPassword': '輸入新密碼',
  'Enter email': '數入電子郵箱',
  'Enter username': '輸入用戶名',
  'Enter username or email': '輸入用戶名或電子郵箱',
  error: {
    accounts: {
      'Invalid email or username': '無效的密碼或用戶名',
      'Internal server error': '內部服務器錯誤',
      'undefined': '服務未配置',
    },
  },
  'or use': '或是使用',
});

Consider running: meteor npm install --save tracker-component

I'm getting:

Unable to resolve some modules:

  "tracker-component" in /Users/sacha/Dev/packages/react-accounts-ui/imports/ui/components/LoginForm.jsx (os.osx.x86_64)

Consider running: meteor npm install --save tracker-component

But installing tracker-component then gives me:

npm ERR! notarget No compatible version found: react@'>=15.0.0 <16.0.0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.10.0-rc1","0.11.0-rc1","0.0.1","0.0.2","0.0.3","0.1.2","0.2.0","0.2.1","0.2.2","0.2.3","0.2.4","0.2.5","0.2.6","0.3.0","0.3.4","0.3.5","0.5.0","0.5.1","0.5.2","0.6.0","0.6.1","0.6.2","0.6.3","0.7.0","0.7.1","0.8.0","0.9.0-rc1","0.9.0","0.10.0-rc1","0.10.0","0.11.0-rc1","0.11.0","0.11.1","0.11.2","0.12.0-rc1","0.12.0","0.12.1","0.12.2","0.13.0-alpha.1","0.13.0-alpha.2","0.13.0-beta.1","0.13.0-beta.2","0.13.0-rc1","0.13.0-rc2","0.13.0","0.13.1","0.13.2","0.13.3","0.14.0-alpha1","0.14.0-alpha2","0.14.0-alpha3","0.14.0-beta1","0.14.0-beta2","0.14.0-beta3","0.14.0-rc1","0.14.0","0.14.1","0.14.2","0.14.3","0.14.4","0.14.5","0.14.6","0.15.0-alpha.1","0.14.7","15.0.0-rc.1","15.0.0-rc.2"]

Does this package depend on React 15? It won't work with previous versions?

How to add "Confirm Password" Fields

Been wrecking my head on figuring out how to make a Confirm Password field when Signing In and also Changing Password. Any help would be great.

Changing Google accounts scope with requestPermissions

For some reason (I think Google is changing the scope declaration pattern), the latest version of the google-accounts package has a dependency that no longer pulls email from a Google oAuth. I tried to expand the scope with the follow but it does not seem to pick up those values.

Accounts.ui.config({
    requestPermissions: {
        google: [
            'https://www.googleapis.com/auth/userinfo.profile',
            'https://www.googleapis.com/auth/userinfo.email',
        ]
    }
 });

In the meantime I have able to just create my own button that triggers the following, but I imagine there is a cleaner fix. Any ideas?

handleGoogleClick(event) {
    event.preventDefault();
    Meteor.loginWithGoogle({
        requestPermissions: ['email']
    }, function (err) {
         if (!err) {
             const userId = Meteor.userId();
         }
     });
  }

Correct Place to Set Up Accounts.config on the Server?

I see this helpful message in the console:

Accounts.config was called on the client but not on the server; some configuration options may not take effect.

Where is the correct place for me to set up Accounts.config on the server? I'm using Mantra.

BUG: Error «Need to set a username or email» when email is set

Hello,

Using latest version as of now.

Steps to reproduce:

  1. First fill out login form with both email and password,
  2. Then click register button.
  3. Finally click register button again.
  4. Observe error message.

Changing the already set email-field makes it work again.
But this is no solution.

What to do? :)

Another newbie question

I keep getting "Signups forbidden", even with

forbidClientAccountCreation: false

I did a meteor reset a few times...please advise

BUG: Clicking reset password link in email does not redirect to page

Hi,

With the latest version, I cannot get resetPasswordPath, nor onResetPasswordHook to have any effect.

The link just redirects to localhost:3000 in development where nothings happens. Only when I manually go to '/login' by clicking my own login-link, do I see that form has a reset-password state.

Please advise. :)

The app will crash if go to any accounts relation routers when the user already logged in

The app will crash if go to any accounts relation routers when the user already logged in,
like /login, /signup, /reset-password, /profile.

I found in LoginForm.jsx is using (user && formState == STATES.PROFILE && (user && 'password' in user.services)) to add changePassword button,

But the app will crach in the user.services is undefined.
LoginForm.jsx:287 Uncaught TypeError: Cannot use 'in' operator to search for 'password' in undefined

In the Meteor guild, the user services field will not auto send to client,
is it correct using user.services is client side?

Problems with links and state

I am experimenting inconsistencies, when I try to set the path to certain states i.e. signUpPath = '/register' corresponds to STATES.SIGN_UP and loginPath='/login' corresponds to STATES.SIGN_IN.

e.g. when I am in /password-reset and click to Sign In which redirects me to /login the state for the form is STATES.SIGN_UP instead of STATES.SIGN_IN.

Anyone experimenting the same?

Missing translations

As you can see, some translations are missing when using meteor-accounts-t9n:

https://s3.amazonaws.com/f.cl.ly/items/093D0B0q0K1K2E162C1T/Screen%20Shot%202016-06-10%20at%2010.14.15%20AM.png?v=cfe8c7c2

What's the best way to add them in? Make a PR to accounts-t9n? Or is there somewhere in this repo where I could translate them?

Buttons are Disabled - Uncaught Invariant Violation: getNodeFromInstance: Invalid argument.

I've successfully gotten the elements to render on the page, but none of the buttons work. Upon entering a valid email address, I am able to at least switch between signin/signup/forgot, but I can never submit any of these forms.

I have had this problems on a few build outs, including trying to run superlumen's base system. A friend of mine had the forms working in one repository, but I could not get that same repository to run on my system. Similarly, superlumen's build had the same error on my friend's computer. We were not able to see any obvious environment differences.

This is on Meteor 1.3.4.1.

Investigate possibility to publish on npm

Hi, I am using this in the mantra-sample-app.
And when writing a test for it i get the error:

Error: Cannot find module 'meteor/std-accounts-ui
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
...

The app works fine. I did run the command meteor add std-accounts-ui

So my guess is the unit testing (mocha) has problems with atmosphere packages and i would like to test it with npm package instead.

Does accounts-ui require tracker-component?

Since I updated from 1.1.13 to 1.1.15 (and meteor to 1.3.1), the tmeasday:check-npm-versions package was added.

updated to Meteor 1.3.1.          

Changes to your project's package version selections from updating package
versions:

std:accounts-basic           upgraded from 1.1.8 to 1.1.9
std:accounts-ui              upgraded from 1.1.13 to 1.1.15
tmeasday:check-npm-versions  added, version 0.1.1

And an error appeared to my console browser:
Uncaught Error: tracker-component@^1.3.13 not installed.

The package is actually installed in node_modules. Is this a tmeasday:check-npm-versions or meteor 1.3.1 bug?

Crash when launching the app just after this package install

Here's the stack trace. I'll try to investigate.
W20160330-23:33:15.732(2)? (STDERR) W20160330-23:33:15.732(2)? (STDERR) /Users/maz-dev/.meteor/packages/meteor-tool/.1.3.0_3.3ma3kz++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:267 W20160330-23:33:15.732(2)? (STDERR) throw(ex); W20160330-23:33:15.732(2)? (STDERR) ^ W20160330-23:33:15.823(2)? (STDERR) TypeError: Cannot set property 'loginNoPassword' of undefined W20160330-23:33:15.823(2)? (STDERR) at meteorInstall.node_modules.meteor.studiointeract:react-accounts-ui.imports.api.server.loginWithoutPassword.js (packages/studiointeract:react-accounts-ui/imports/api/server/loginWithoutPassword.js:87:1) W20160330-23:33:15.823(2)? (STDERR) at fileEvaluate (packages/modules-runtime.js:158:9) W20160330-23:33:15.823(2)? (STDERR) at require (packages/modules-runtime.js:92:16) W20160330-23:33:15.824(2)? (STDERR) at meteorInstall.node_modules.meteor.studiointeract:react-accounts-ui.main_server.js (packages/studiointeract:react-accounts-ui/main_server.js:5:1) W20160330-23:33:15.824(2)? (STDERR) at fileEvaluate (packages/modules-runtime.js:158:9) W20160330-23:33:15.824(2)? (STDERR) at require (packages/modules-runtime.js:92:16) W20160330-23:33:15.825(2)? (STDERR) at /Users/maz-dev/code/saintejs/.meteor/local/build/programs/server/packages/studiointeract_react-accounts-ui.js:24855:15 W20160330-23:33:15.825(2)? (STDERR) at /Users/maz-dev/code/saintejs/.meteor/local/build/programs/server/packages/studiointeract_react-accounts-ui.js:24861:3 W20160330-23:33:15.826(2)? (STDERR) at /Users/maz-dev/code/saintejs/.meteor/local/build/programs/server/boot.js:283:10 W20160330-23:33:15.826(2)? (STDERR) at Array.forEach (native)

Passing State with React Router

I have tried implementing the formState in React Router example from the docs: <Route path="/signup" component={ Accounts.ui.LoginForm } formState={ STATES.SIGN_UP } /> to no avail. If I place <Accounts.ui.LoginForm formState={ STATES.SIGN_UP } /> into its own component and instead call that component into the route, I can at least set the state when that route is entered, but I obviously cannot control the flow the opposite direction (if a user hits Sign In then they will see those form fields but the URL will not change).

Is there anyway to get the intended results from the original code sample? A friend has been able to implement it within Flow Router, so I might drift that direction but wanted to see if this was an issue in the community.

Newbie Question: Cannot find module 'meteor/std:accounts-ui'?

I installed accounts-ui using these commands:

npm i --save react react-dom react-router
meteor add accounts-password
meteor add std:accounts-ui
npm i --save tracker-component

On running, the console shows the following errors:

Uncaught Error: Cannot find module 'tracker-component/package.json'
Uncaught Error: Cannot find module 'meteor/std:accounts-ui'

What am I missing?

unexpected reload

when trying to log in (pressing sign in button or hitting enter) a page reload is made with the same url but a "?" is added. This happens on any page including the LoginForm.

I tried commenting out all customized configuration

import { Accounts } from 'meteor/std:accounts-ui';

export default function () {
  Accounts.ui.config({
    passwordSignupFields: 'USERNAME_AND_EMAIL',
    // loginPath: '/login',
    // signUpPath: '/register',
    // resetPasswordPath: '/reset-password',
    // profilePath: '/profile',
    // onSignedInHook: () => FlowRouter.go('/dashboard'),
    // onSignedOutHook: () => FlowRouter.go('/'),
    // minimumPasswordLength: 6
  });
}

using default Accounts.ui.LoginForm but it does not help.
The problems started in 1.1.4
I have gone back to version 1.1.0
:-(

Install gets stuck

For some reason, I can’t seem to finish the installation. When I enter “meteor add std:accounts-ui” it downloads and loads various things, but it gets stuck at this point: “Extracting std:[email protected]...”

Any idea about what I’m doing wrong, or how I can fix it?
The machine is running Windows 7.

Invalid key: preSignUpHook

Looks like this particular hook is breaking the package. If you try to add it in your config:

Accounts.ui.config({
  passwordSignupFields: 'EMAIL_ONLY',
  loginPath: '/',
  onSignedInHook: () => FlowRouter.go('/dashboard'),
  onSignedOutHook: () => FlowRouter.go('/'),
  preSignUpHook: () => { console.log('hello') }
});

You get an error of:
Uncaught Error: Accounts.ui.config: Invalid key: preSignUpHook

If you take it out:

Accounts.ui.config({
  passwordSignupFields: 'EMAIL_ONLY',
  loginPath: '/',
  onSignedInHook: () => FlowRouter.go('/dashboard'),
  onSignedOutHook: () => FlowRouter.go('/'),
  // preSignUpHook: () => { console.log('hello') }
});

You get an error of:
Uncaught TypeError: _accountsBase.Accounts.ui._options.preSignUpHook is not a function

Support for inline field validation message?

Customizing a theme based on this package...progress is good but can't seem to get the form error messages to show next to input fields.

I am using MDL. It looks something like:

  <div class="mdl-textfield mdl-js-textfield">
    <input class="mdl-textfield__input" type="text" id="sample2">
    <label class="mdl-textfield__label" for="sample2">Number...</label>
    <!-- render this on error -->
    <span class="mdl-textfield__error">Input is not a number!</span>
  </div>

Any hints on how this can be done or is this a feature request?

Change in formState property is not passed down to state in LoginForm component

Hey there,

I noticed that once the LoginForm component is constructed nothing happens when the formState property is changed, through e.g. something like this:

FlowRouter.route('/login', {
    name: 'users.login',
    action() {
      mount(MainLayoutCtx, {
        content: () => (<Accounts.ui.LoginForm {...{
          formState: STATES.SIGN_IN,
          signUpPath: '/signup',
        }} />),
      });
    },
  });

So when your app has two links in the navbar, one to the signup and one to the login form, the user cannot switch between the two forms using these links.

I think it's simple to fix and will provide a pull request shortly..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.