From 84bfa0051b8280c8f1632dce09f62619476271bd Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Wed, 5 Apr 2017 23:12:46 +0200 Subject: [PATCH 01/15] Replacing dependency on tracker-component with react-meteor-data. --- imports/ui/components/LoginForm.jsx | 55 ++++++++++++++++++----------- main_client.js | 10 +++--- main_server.js | 10 +++--- package.js | 1 + package.json | 6 ++-- 5 files changed, 51 insertions(+), 31 deletions(-) diff --git a/imports/ui/components/LoginForm.jsx b/imports/ui/components/LoginForm.jsx index cc51186..40fad28 100644 --- a/imports/ui/components/LoginForm.jsx +++ b/imports/ui/components/LoginForm.jsx @@ -1,6 +1,6 @@ -import React from 'react'; +import React, { PropTypes, Component } from 'react'; import ReactDOM from 'react-dom'; -import Tracker from 'tracker-component'; +import { createContainer } from 'meteor/react-meteor-data'; import { Accounts } from 'meteor/accounts-base'; import { T9n } from 'meteor/softwarerero:accounts-t9n'; import { KEY_PREFIX } from '../../login_session.js'; @@ -18,7 +18,7 @@ import { capitalize } from '../../helpers.js'; -export class LoginForm extends Tracker.Component { +class LoginForm extends Component { constructor(props) { super(props); let { @@ -71,22 +71,11 @@ export class LoginForm extends Tracker.Component { Session.set(KEY_PREFIX + 'state', null); break; } - + // Add default field values once the form did mount on the client this.setState(prevState => ({ ...this.getDefaultFieldValues(), })); - - // Listen for the user to login/logout. - this.autorun(() => { - - // Add the services list to the user. - this.subscribe('servicesList'); - this.setState({ - user: Accounts.user() - }); - - }); } componentWillReceiveProps(nextProps, nextContext) { @@ -99,9 +88,9 @@ export class LoginForm extends Tracker.Component { } componentDidUpdate(prevProps, prevState) { - if (!prevState.user !== !this.state.user) { + if (!prevProps.user !== !this.props.user) { this.setState({ - formState: this.state.user ? STATES.PROFILE : STATES.SIGN_IN + formState: this.props.user ? STATES.PROFILE : STATES.SIGN_IN }); } } @@ -309,7 +298,8 @@ export class LoginForm extends Tracker.Component { changePasswordPath = Accounts.ui._options.changePasswordPath, profilePath = Accounts.ui._options.profilePath, } = this.props; - const { formState, waiting, user } = this.state; + const { user } = this.props; + const { formState, waiting } = this.state; let loginButtons = []; if (user && formState == STATES.PROFILE) { @@ -457,7 +447,7 @@ export class LoginForm extends Tracker.Component { } showForgotPasswordLink() { - return !this.state.user + return !this.props.user && this.state.formState == STATES.SIGN_IN && _.contains( ["USERNAME_AND_EMAIL", "USERNAME_AND_OPTIONAL_EMAIL", "EMAIL_ONLY"], @@ -662,7 +652,8 @@ export class LoginForm extends Tracker.Component { } oauthSignIn(serviceName) { - const { formState, waiting, user, onSubmitHook } = this.state; + const { user } = this.props; + const { formState, waiting, onSubmitHook } = this.state; //Thanks Josh Owens for this one. function capitalService() { return serviceName.charAt(0).toUpperCase() + serviceName.slice(1); @@ -998,5 +989,29 @@ export class LoginForm extends Tracker.Component { ); } } +LoginForm.propTypes = { + formState: PropTypes.string, + loginPath: PropTypes.string, + signUpPath: PropTypes.string, + resetPasswordPath: PropTypes.string, + profilePath: PropTypes.string, + changePasswordPath: PropTypes.string, +}; +LoginForm.defaultProps = { + formState: null, + loginPath: null, + signUpPath: null, + resetPasswordPath: null, + profilePath: null, + changePasswordPath: null, +}; Accounts.ui.LoginForm = LoginForm; + +export default createContainer(() => { + // Listen for the user to login/logout and the services list to the user. + Meteor.subscribe('servicesList'); + return ({ + user: Accounts.user(), + }); +}, LoginForm); diff --git a/main_client.js b/main_client.js index 68919b9..e73715e 100644 --- a/main_client.js +++ b/main_client.js @@ -3,8 +3,10 @@ import './imports/accounts_ui.js'; import './imports/login_session.js'; import { STATES } from './imports/helpers.js'; import './imports/api/client/loginWithoutPassword.js'; +import LoginForm from './imports/ui/components/LoginForm.jsx'; -import './imports/ui/components/LoginForm.jsx'; - -export { Accounts, STATES }; -export default Accounts; +export { + LoginForm as default, + Accounts, + STATES, +}; diff --git a/main_server.js b/main_server.js index 6dfc35e..10d0d78 100644 --- a/main_server.js +++ b/main_server.js @@ -4,8 +4,10 @@ import './imports/login_session.js'; import { redirect, STATES } from './imports/helpers.js'; import './imports/api/server/loginWithoutPassword.js'; import './imports/api/server/servicesListPublication.js'; +import LoginForm from './imports/ui/components/LoginForm.jsx'; -import './imports/ui/components/LoginForm.jsx'; - -export { Accounts, redirect, STATES }; -export default Accounts; +export { + LoginForm as default, + Accounts, + STATES, +}; diff --git a/package.js b/package.js index cbab22e..35a5d58 100644 --- a/package.js +++ b/package.js @@ -16,6 +16,7 @@ Package.onUse(function(api) { api.use('random'); api.use('email'); api.use('session'); + api.use('react-meteor-data'); api.use('softwarerero:accounts-t9n'); api.use('tmeasday:check-npm-versions@0.3.0'); diff --git a/package.json b/package.json index d96787a..816fe10 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,8 @@ "homepage": "https://github.com/studiointeract/accounts-ui", "dependencies": {}, "peerDependencies": { - "react": ">=0.14.7 || ^15.0.0", - "react-dom": ">=0.14.7 || ^15.0.0", - "tracker-component": "^1.3.16" + "react": "^15.0.0", + "react-dom": "^15.0.0", + "react-addons-pure-render-mixin": "^15.0.0" } } From f7cdcd0b55114e6442dc369d46945f32be9e3985 Mon Sep 17 00:00:00 2001 From: Sebastian Ilves Date: Fri, 26 May 2017 14:02:36 +0200 Subject: [PATCH 02/15] Added support for different translation functions --- CHANGELOG.md | 5 + README.md | 14 ++- imports/helpers.js | 9 +- imports/ui/components/Button.jsx | 3 +- imports/ui/components/Field.jsx | 3 +- imports/ui/components/Form.jsx | 16 ++-- imports/ui/components/LoginForm.jsx | 100 +++++++++++--------- imports/ui/components/PasswordOrService.jsx | 7 +- package.js | 2 +- 9 files changed, 94 insertions(+), 65 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 057432b..fca3ed3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # ChangeLog +### v1.2.21 +26-May-2017 + +* Added functionality to include your own translation function. + ### v1.2.20 13-March-2017 diff --git a/README.md b/README.md index dfb2766..f88f1bc 100644 --- a/README.md +++ b/README.md @@ -399,14 +399,15 @@ To install the dependencies added in your package.json run: // main.jsx import React from 'react'; +import PropTypes from 'prop-types'; import { Accounts, STATES } from 'meteor/std:accounts-ui'; /** * Form.propTypes = { - * fields: React.PropTypes.object.isRequired, - * buttons: React.PropTypes.object.isRequired, - * error: React.PropTypes.string, - * ready: React.PropTypes.bool + * fields: PropTypes.object.isRequired, + * buttons: PropTypes.object.isRequired, + * error: PropTypes.string, + * ready: PropTypes.bool * }; */ class Form extends Accounts.ui.Form { @@ -482,6 +483,11 @@ class NewLogin extends Accounts.ui.LoginForm { 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) { diff --git a/imports/helpers.js b/imports/helpers.js index 53b6842..2be5fb7 100644 --- a/imports/helpers.js +++ b/imports/helpers.js @@ -64,10 +64,10 @@ export function validateEmail(email, showMessage, clearMessage) { if (Accounts.ui._options.emailPattern.test(email)) { return true; } else if (!email || email.length === 0) { - showMessage(T9n.get("error.emailRequired"), 'warning', false, 'email'); + showMessage("error.emailRequired", 'warning', false, 'email'); return false; } else { - showMessage(T9n.get("error.accounts.Invalid email"), 'warning', false, 'email'); + showMessage("error.accounts.Invalid email", 'warning', false, 'email'); return false; } } @@ -76,7 +76,8 @@ export function validatePassword(password = '', showMessage, clearMessage){ if (password.length >= Accounts.ui._options.minimumPasswordLength) { return true; } else { - const errMsg = T9n.get("error.minChar").replace(/7/, Accounts.ui._options.minimumPasswordLength); + // const errMsg = T9n.get("error.minChar").replace(/7/, Accounts.ui._options.minimumPasswordLength); + const errMsg = "error.minChar" showMessage(errMsg, 'warning', false, 'password'); return false; } @@ -87,7 +88,7 @@ export function validateUsername(username, showMessage, clearMessage, formState) return true; } else { const fieldName = (passwordSignupFields() === 'USERNAME_ONLY' || formState === STATES.SIGN_UP) ? 'username' : 'usernameOrEmail'; - showMessage(T9n.get("error.usernameRequired"), 'warning', false, fieldName); + showMessage("error.usernameRequired", 'warning', false, fieldName); return false; } } diff --git a/imports/ui/components/Button.jsx b/imports/ui/components/Button.jsx index a22198b..d2e7ee6 100644 --- a/imports/ui/components/Button.jsx +++ b/imports/ui/components/Button.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import { Accounts } from 'meteor/accounts-base'; let Link; try { Link = require('react-router').Link; } catch(e) {} @@ -28,7 +29,7 @@ export class Button extends React.Component { } } Button.propTypes = { - onClick: React.PropTypes.func + onClick: PropTypes.func }; Accounts.ui.Button = Button; diff --git a/imports/ui/components/Field.jsx b/imports/ui/components/Field.jsx index 79e0076..8e1a1f6 100644 --- a/imports/ui/components/Field.jsx +++ b/imports/ui/components/Field.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import { Accounts } from 'meteor/accounts-base'; export class Field extends React.Component { @@ -69,7 +70,7 @@ export class Field extends React.Component { } } Field.propTypes = { - onChange: React.PropTypes.func + onChange: PropTypes.func }; Accounts.ui.Field = Field; diff --git a/imports/ui/components/Form.jsx b/imports/ui/components/Form.jsx index a4301c0..9efe2c2 100644 --- a/imports/ui/components/Form.jsx +++ b/imports/ui/components/Form.jsx @@ -1,5 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; +import PropTypes from 'prop-types'; import { Accounts } from 'meteor/accounts-base'; import './Fields.jsx'; import './Buttons.jsx'; @@ -26,9 +27,11 @@ export class Form extends React.Component { buttons, error, messages, + translate, ready = true, className } = this.props; + console.log(this.props); return (
this.form = ref} @@ -38,7 +41,7 @@ export class Form extends React.Component { > - + @@ -46,11 +49,12 @@ export class Form extends React.Component { } } Form.propTypes = { - oauthServices: React.PropTypes.object, - fields: React.PropTypes.object.isRequired, - buttons: React.PropTypes.object.isRequired, - error: React.PropTypes.string, - ready: React.PropTypes.bool + oauthServices: PropTypes.object, + fields: PropTypes.object.isRequired, + buttons: PropTypes.object.isRequired, + translate: PropTypes.func.isRequired, + error: PropTypes.string, + ready: PropTypes.bool }; Accounts.ui.Form = Form; diff --git a/imports/ui/components/LoginForm.jsx b/imports/ui/components/LoginForm.jsx index cc51186..baba645 100644 --- a/imports/ui/components/LoginForm.jsx +++ b/imports/ui/components/LoginForm.jsx @@ -45,6 +45,7 @@ export class LoginForm extends Tracker.Component { onPreSignUpHook: props.onPreSignUpHook || Accounts.ui._options.onPreSignUpHook, onPostSignUpHook: props.onPostSignUpHook || Accounts.ui._options.onPostSignUpHook, }; + this.translate = this.translate.bind(this); } componentDidMount() { @@ -71,21 +72,21 @@ export class LoginForm extends Tracker.Component { Session.set(KEY_PREFIX + 'state', null); break; } - + // Add default field values once the form did mount on the client this.setState(prevState => ({ ...this.getDefaultFieldValues(), })); - + // Listen for the user to login/logout. this.autorun(() => { - + // Add the services list to the user. this.subscribe('servicesList'); this.setState({ user: Accounts.user() }); - + }); } @@ -106,6 +107,13 @@ export class LoginForm extends Tracker.Component { } } + translate(text) { + // if (this.props.t) { + // return this.props.t(text); + // } + return T9n.get(text); + } + validateField(field, value) { const { formState } = this.state; switch(field) { @@ -131,8 +139,8 @@ export class LoginForm extends Tracker.Component { getUsernameOrEmailField() { return { id: 'usernameOrEmail', - hint: T9n.get('enterUsernameOrEmail'), - label: T9n.get('usernameOrEmail'), + hint: this.translate('enterUsernameOrEmail'), + label: this.translate('usernameOrEmail'), required: true, defaultValue: this.state.username || "", onChange: this.handleChange.bind(this, 'usernameOrEmail'), @@ -143,8 +151,8 @@ export class LoginForm extends Tracker.Component { getUsernameField() { return { id: 'username', - hint: T9n.get('enterUsername'), - label: T9n.get('username'), + hint: this.translate('enterUsername'), + label: this.translate('username'), required: true, defaultValue: this.state.username || "", onChange: this.handleChange.bind(this, 'username'), @@ -155,8 +163,8 @@ export class LoginForm extends Tracker.Component { getEmailField() { return { id: 'email', - hint: T9n.get('enterEmail'), - label: T9n.get('email'), + hint: this.translate('enterEmail'), + label: this.translate('email'), type: 'email', required: true, defaultValue: this.state.email || "", @@ -168,8 +176,8 @@ export class LoginForm extends Tracker.Component { getPasswordField() { return { id: 'password', - hint: T9n.get('enterPassword'), - label: T9n.get('password'), + hint: this.translate('enterPassword'), + label: this.translate('password'), type: 'password', required: true, defaultValue: this.state.password || "", @@ -181,8 +189,8 @@ export class LoginForm extends Tracker.Component { getSetPasswordField() { return { id: 'newPassword', - hint: T9n.get('enterPassword'), - label: T9n.get('choosePassword'), + hint: this.translate('enterPassword'), + label: this.translate('choosePassword'), type: 'password', required: true, onChange: this.handleChange.bind(this, 'newPassword') @@ -192,8 +200,8 @@ export class LoginForm extends Tracker.Component { getNewPasswordField() { return { id: 'newPassword', - hint: T9n.get('enterNewPassword'), - label: T9n.get('newPassword'), + hint: this.translate('enterNewPassword'), + label: this.translate('newPassword'), type: 'password', required: true, onChange: this.handleChange.bind(this, 'newPassword'), @@ -315,7 +323,7 @@ export class LoginForm extends Tracker.Component { if (user && formState == STATES.PROFILE) { loginButtons.push({ id: 'signOut', - label: T9n.get('signOut'), + label: this.translate('signOut'), disabled: waiting, onClick: this.signOut.bind(this) }); @@ -324,7 +332,7 @@ export class LoginForm extends Tracker.Component { if (this.showCreateAccountLink()) { loginButtons.push({ id: 'switchToSignUp', - label: T9n.get('signUp'), + label: this.translate('signUp'), type: 'link', href: signUpPath, onClick: this.switchToSignUp.bind(this) @@ -334,7 +342,7 @@ export class LoginForm extends Tracker.Component { if (formState == STATES.SIGN_UP || formState == STATES.PASSWORD_RESET) { loginButtons.push({ id: 'switchToSignIn', - label: T9n.get('signIn'), + label: this.translate('signIn'), type: 'link', href: loginPath, onClick: this.switchToSignIn.bind(this) @@ -344,7 +352,7 @@ export class LoginForm extends Tracker.Component { if (this.showForgotPasswordLink()) { loginButtons.push({ id: 'switchToPasswordReset', - label: T9n.get('forgotPassword'), + label: this.translate('forgotPassword'), type: 'link', href: resetPasswordPath, onClick: this.switchToPasswordReset.bind(this) @@ -359,7 +367,7 @@ export class LoginForm extends Tracker.Component { && (user.services && 'password' in user.services)) { loginButtons.push({ id: 'switchToChangePassword', - label: T9n.get('changePassword'), + label: this.translate('changePassword'), type: 'link', href: changePasswordPath, onClick: this.switchToChangePassword.bind(this) @@ -369,7 +377,7 @@ export class LoginForm extends Tracker.Component { if (formState == STATES.SIGN_UP) { loginButtons.push({ id: 'signUp', - label: T9n.get('signUp'), + label: this.translate('signUp'), type: hasPasswordService() ? 'submit' : 'link', className: 'active', disabled: waiting, @@ -380,7 +388,7 @@ export class LoginForm extends Tracker.Component { if (this.showSignInLink()) { loginButtons.push({ id: 'signIn', - label: T9n.get('signIn'), + label: this.translate('signIn'), type: hasPasswordService() ? 'submit' : 'link', className: 'active', disabled: waiting, @@ -391,7 +399,7 @@ export class LoginForm extends Tracker.Component { if (formState == STATES.PASSWORD_RESET) { loginButtons.push({ id: 'emailResetLink', - label: T9n.get('resetYourPassword'), + label: this.translate('resetYourPassword'), type: 'submit', disabled: waiting, onClick: this.passwordReset.bind(this) @@ -401,7 +409,7 @@ export class LoginForm extends Tracker.Component { if (this.showPasswordChangeForm() || this.showEnrollAccountForm()) { loginButtons.push({ id: 'changePassword', - label: (this.showPasswordChangeForm() ? T9n.get('changePassword') : T9n.get('setPassword')), + label: (this.showPasswordChangeForm() ? this.translate('changePassword') : this.translate('setPassword')), type: 'submit', disabled: waiting, onClick: this.passwordChange.bind(this) @@ -410,7 +418,7 @@ export class LoginForm extends Tracker.Component { if (Accounts.user()) { loginButtons.push({ id: 'switchToSignOut', - label: T9n.get('cancel'), + label: this.translate('cancel'), type: 'link', href: profilePath, onClick: this.switchToSignOut.bind(this) @@ -418,7 +426,7 @@ export class LoginForm extends Tracker.Component { } else { loginButtons.push({ id: 'cancelResetPassword', - label: T9n.get('cancel'), + label: this.translate('cancel'), type: 'link', onClick: this.cancelResetPassword.bind(this), }); @@ -627,7 +635,7 @@ export class LoginForm extends Tracker.Component { Meteor.loginWithPassword(loginSelector, password, (error, result) => { onSubmitHook(error,formState); if (error) { - this.showMessage(T9n.get(`error.accounts.${error.reason}`) || T9n.get("Unknown error"), 'error'); + this.showMessage(`error.accounts.${error.reason}` || "unknown_error", 'error'); } else { loginResultCallback(() => this.state.onSignedInHook()); @@ -683,10 +691,11 @@ export class LoginForm extends Tracker.Component { options.forceApprovalPrompt = Accounts.ui._options.forceApprovalPrompt[serviceName]; this.clearMessages(); + const self = this loginWithService(options, (error) => { onSubmitHook(error,formState); if (error) { - this.showMessage(T9n.get(`error.accounts.${error.reason}`) || T9n.get("Unknown error")); + this.showMessage(`error.accounts.${error.reason}` || "unknown_error"); } else { this.setState({ formState: STATES.PROFILE }); this.clearDefaultFieldValues(); @@ -753,12 +762,12 @@ export class LoginForm extends Tracker.Component { const SignUp = function(_options) { Accounts.createUser(_options, (error) => { if (error) { - this.showMessage(T9n.get(`error.accounts.${error.reason}`) || T9n.get("Unknown error"), 'error'); - if (T9n.get(`error.accounts.${error.reason}`)) { + this.showMessage(`error.accounts.${error.reason}` || "unknown_error", 'error'); + if (this.translate(`error.accounts.${error.reason}`)) { onSubmitHook(`error.accounts.${error.reason}`, formState); } else { - onSubmitHook("Unknown error", formState); + onSubmitHook("unknown_error", formState); } } else { @@ -804,10 +813,10 @@ export class LoginForm extends Tracker.Component { Accounts.loginWithoutPassword({ email: email }, (error) => { if (error) { - this.showMessage(T9n.get(`error.accounts.${error.reason}`) || T9n.get("Unknown error"), 'error'); + this.showMessage(`error.accounts.${error.reason}` || "unknown_error", 'error'); } else { - this.showMessage(T9n.get("info.emailSent"), 'success', 5000); + this.showMessage(this.translate("info.emailSent"), 'success', 5000); this.clearDefaultFieldValues(); } onSubmitHook(error, formState); @@ -818,10 +827,10 @@ export class LoginForm extends Tracker.Component { Accounts.loginWithoutPassword({ email: usernameOrEmail, username: usernameOrEmail }, (error) => { if (error) { - this.showMessage(T9n.get(`error.accounts.${error.reason}`) || T9n.get("Unknown error"), 'error'); + this.showMessage(`error.accounts.${error.reason}` || "unknown_error", 'error'); } else { - this.showMessage(T9n.get("info.emailSent"), 'success', 5000); + this.showMessage(this.translate("info.emailSent"), 'success', 5000); this.clearDefaultFieldValues(); } onSubmitHook(error, formState); @@ -830,10 +839,10 @@ export class LoginForm extends Tracker.Component { } else { let errMsg = null; if (_.contains([ "USERNAME_AND_EMAIL_NO_PASSWORD" ], passwordSignupFields())) { - errMsg = T9n.get("error.accounts.Invalid email or username"); + errMsg = this.translate("error.accounts.invalid_email"); } else { - errMsg = T9n.get("error.accounts.Invalid email"); + errMsg = this.translate("error.accounts.invalid_email"); } this.showMessage(errMsg,'warning'); onSubmitHook(errMsg, formState); @@ -858,10 +867,10 @@ export class LoginForm extends Tracker.Component { Accounts.forgotPassword({ email: email }, (error) => { if (error) { - this.showMessage(T9n.get(`error.accounts.${error.reason}`) || T9n.get("Unknown error"), 'error'); + this.showMessage(`error.accounts.${error.reason}` || "unknown_error", 'error'); } else { - this.showMessage(T9n.get("info.emailSent"), 'success', 5000); + this.showMessage(this.translate("info.emailSent"), 'success', 5000); this.clearDefaultFieldValues(); } onSubmitHook(error, formState); @@ -891,11 +900,11 @@ export class LoginForm extends Tracker.Component { if (token) { Accounts.resetPassword(token, newPassword, (error) => { if (error) { - this.showMessage(T9n.get(`error.accounts.${error.reason}`) || T9n.get("Unknown error"), 'error'); + this.showMessage(`error.accounts.${error.reason}` || "unknown_error", 'error'); onSubmitHook(error, formState); } else { - this.showMessage(T9n.get('info.passwordChanged'), 'success', 5000); + this.showMessage(this.translate('info.passwordChanged'), 'success', 5000); onSubmitHook(null, formState); this.setState({ formState: STATES.PROFILE }); Accounts._loginButtonsSession.set('resetPasswordToken', null); @@ -907,11 +916,11 @@ export class LoginForm extends Tracker.Component { else { Accounts.changePassword(password, newPassword, (error) => { if (error) { - this.showMessage(T9n.get(`error.accounts.${error.reason}`) || T9n.get("Unknown error"), 'error'); + this.showMessage(`error.accounts.${error.reason}` || "unknown_error", 'error'); onSubmitHook(error, formState); } else { - this.showMessage(T9n.get('info.passwordChanged'), 'success', 5000); + this.showMessage('info.passwordChanged', 'success', 5000); onSubmitHook(null, formState); this.setState({ formState: STATES.PROFILE }); this.clearDefaultFieldValues(); @@ -921,7 +930,7 @@ export class LoginForm extends Tracker.Component { } showMessage(message, type, clearTimeout, field){ - message = message.trim(); + message = this.translate(message).trim(); if (message) { this.setState(({ messages = [] }) => { messages.push({ @@ -994,6 +1003,7 @@ export class LoginForm extends Tracker.Component { buttons={this.buttons()} {...this.state} message={message} + translate={this.translate} /> ); } diff --git a/imports/ui/components/PasswordOrService.jsx b/imports/ui/components/PasswordOrService.jsx index c0cc786..b399931 100644 --- a/imports/ui/components/PasswordOrService.jsx +++ b/imports/ui/components/PasswordOrService.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import { Accounts } from 'meteor/accounts-base'; import { T9n } from 'meteor/softwarerero:accounts-t9n'; import { hasPasswordService } from '../../helpers.js'; @@ -15,7 +16,7 @@ export class PasswordOrService extends React.Component { } render () { - let { className = "password-or-service", style = {} } = this.props; + let { className = "password-or-service", style = {}, translate } = this.props; let { hasPasswordService, services } = this.state; labels = services; if (services.length > 2) { @@ -25,7 +26,7 @@ export class PasswordOrService extends React.Component { if (hasPasswordService && services.length > 0) { return (
- { `${T9n.get('orUse')} ${ labels.join(' / ') }` } + { `${translate('orUse')} ${ labels.join(' / ') }` }
); } @@ -33,7 +34,7 @@ export class PasswordOrService extends React.Component { } } PasswordOrService.propTypes = { - oauthServices: React.PropTypes.object + oauthServices: PropTypes.object }; Accounts.ui.PasswordOrService = PasswordOrService; diff --git a/package.js b/package.js index cbab22e..5f4ddd8 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'std:accounts-ui', - version: '1.2.20', + version: '1.2.21', summary: 'Accounts UI for React in Meteor 1.3+', git: 'https://github.com/studiointeract/accounts-ui', documentation: 'README.md' From fd713325b77b6f06dc33410881a39c97071d2b52 Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Fri, 26 May 2017 14:20:11 +0200 Subject: [PATCH 03/15] Fixed an issue with the translation. --- imports/ui/components/LoginForm.jsx | 2 +- imports/ui/components/PasswordOrService.jsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/imports/ui/components/LoginForm.jsx b/imports/ui/components/LoginForm.jsx index df17a86..093a50f 100644 --- a/imports/ui/components/LoginForm.jsx +++ b/imports/ui/components/LoginForm.jsx @@ -994,7 +994,7 @@ class LoginForm extends Component { buttons={this.buttons()} {...this.state} message={message} - translate={this.translate} + translate={text => this.translate(text)} /> ); } diff --git a/imports/ui/components/PasswordOrService.jsx b/imports/ui/components/PasswordOrService.jsx index fc5bd60..62b8db7 100644 --- a/imports/ui/components/PasswordOrService.jsx +++ b/imports/ui/components/PasswordOrService.jsx @@ -16,6 +16,7 @@ export class PasswordOrService extends React.Component { } translate(text) { + console.log(this); if (this.props.translate) { return this.props.translate(text); } From 03b3c6266543a20a6e51a78d2dbba0e7a227dadb Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Fri, 26 May 2017 14:22:00 +0200 Subject: [PATCH 04/15] Cleaning up. --- imports/ui/components/PasswordOrService.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/imports/ui/components/PasswordOrService.jsx b/imports/ui/components/PasswordOrService.jsx index 62b8db7..fc5bd60 100644 --- a/imports/ui/components/PasswordOrService.jsx +++ b/imports/ui/components/PasswordOrService.jsx @@ -16,7 +16,6 @@ export class PasswordOrService extends React.Component { } translate(text) { - console.log(this); if (this.props.translate) { return this.props.translate(text); } From 43da58a8d87dfd360d3a2ae922eb5667e45afa1f Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Fri, 26 May 2017 14:23:10 +0200 Subject: [PATCH 05/15] 1.2.21 --- .versions | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.versions b/.versions index e72c513..5405a62 100644 --- a/.versions +++ b/.versions @@ -50,7 +50,7 @@ session@1.1.7 softwarerero:accounts-t9n@1.3.3 spacebars@1.0.12 spacebars-compiler@1.0.12 -std:accounts-ui@1.2.20 +std:accounts-ui@1.2.21 tmeasday:check-npm-versions@0.3.0 tracker@1.1.2 ui@1.0.11 diff --git a/README.md b/README.md index f88f1bc..e69ce4b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # React Accounts UI -Current version 1.2.20 +Current version 1.2.21 ## Features From 9009a98f95d2aea5626dc678a5a6ca6e1d546f8d Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Fri, 26 May 2017 14:26:29 +0200 Subject: [PATCH 06/15] Added version constraints. --- .versions | 31 ++++++++++++++++--------------- package.js | 2 +- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.versions b/.versions index 5405a62..d5d2868 100644 --- a/.versions +++ b/.versions @@ -1,10 +1,10 @@ -accounts-base@1.2.15 +accounts-base@1.2.17 allow-deny@1.0.5 -babel-compiler@6.14.1 +babel-compiler@6.18.2 babel-runtime@1.0.1 base64@1.0.10 binary-heap@1.0.10 -blaze@2.1.8 +blaze@2.3.2 blaze-tools@1.0.9 boilerplate-generator@1.0.11 caching-compiler@1.1.9 @@ -12,35 +12,36 @@ callback-hook@1.0.10 check@1.2.5 coffeescript@1.0.17 ddp@1.2.5 -ddp-client@1.3.3 +ddp-client@1.3.4 ddp-common@1.2.8 ddp-rate-limiter@1.0.7 -ddp-server@1.3.13 +ddp-server@1.3.14 deps@1.0.12 diff-sequence@1.0.7 -ecmascript@0.6.3 +ecmascript@0.7.3 ecmascript-runtime@0.3.15 ejson@1.0.13 -email@1.1.18 +email@1.2.1 geojson-utils@1.0.10 html-tools@1.0.10 -htmljs@1.0.10 +htmljs@1.0.11 id-map@1.0.9 jquery@1.11.10 localstorage@1.0.12 logging@1.1.17 meteor@1.6.1 -minimongo@1.0.21 -modules@0.7.9 -modules-runtime@0.7.9 -mongo@1.1.16 +minimongo@1.0.23 +modules@0.8.2 +modules-runtime@0.7.10 +mongo@1.1.17 mongo-id@1.0.6 npm-mongo@2.2.24 observe-sequence@1.0.16 ordered-dict@1.0.9 promise@0.8.8 random@1.0.10 -rate-limit@1.0.7 +rate-limit@1.0.8 +react-meteor-data@0.2.11 reactive-dict@1.1.8 reactive-var@1.0.11 retry@1.0.9 @@ -52,8 +53,8 @@ spacebars@1.0.12 spacebars-compiler@1.0.12 std:accounts-ui@1.2.21 tmeasday:check-npm-versions@0.3.0 -tracker@1.1.2 +tracker@1.1.3 ui@1.0.11 underscore@1.0.10 -webapp@1.3.14 +webapp@1.3.15 webapp-hashing@1.0.9 diff --git a/package.js b/package.js index ce1bef9..a082c9b 100644 --- a/package.js +++ b/package.js @@ -16,7 +16,7 @@ Package.onUse(function(api) { api.use('random'); api.use('email'); api.use('session'); - api.use('react-meteor-data'); + api.use('react-meteor-data@0.2.11'); api.use('softwarerero:accounts-t9n'); api.use('tmeasday:check-npm-versions@0.3.0'); From 9d6e223250a7bcd0b346833828caf4f8fcd4f079 Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Tue, 30 May 2017 07:55:55 +0200 Subject: [PATCH 07/15] Removed example with Tracker.Component --- README.md | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/README.md b/README.md index e69ce4b..4b3f99e 100644 --- a/README.md +++ b/README.md @@ -206,52 +206,6 @@ Meteor.startup( () => { }); ``` -As a bonus, here's a component that redirects to the signin route if you're not -logged in, using [`Tracker.Component`](https://www.npmjs.com/package/tracker-component). - -`npm i --save tracker-component` - -```javascript -import React from 'react'; -import Tracker from 'tracker-component'; -import { Meteor } from 'meteor/meteor'; -import { browserHistory } from 'react-router'; - -const AdminPage = () => ( -

Admin

-); - -export class Admin extends Tracker.Component { - constructor(props) { - super(props); - this.autorun(() => { - this.setState({ - isAuthenticated: Meteor.user() - }); - }); - } - - componentWillMount() { - // Check that the user is logged in before the component mounts - if (!this.state.isAuthenticated) { - browserHistory.push(null, '/signin'); - } - } - - componentDidUpdate() { - // Navigate to a sign in page if the user isn't authenticated when data changes - if (!this.state.isAuthenticated) { - browserHistory.push(null, '/signin'); - } - } - - render() { - return ; - } -} - -``` - You can learn more about the remaining components here in the tutorial on [React Router Basics](https://themeteorchef.com/snippets/react-router-basics/) by the Meteor Chef. From 5a5790f3482793efd7c21267b9c9cf5501879d51 Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Tue, 30 May 2017 07:57:26 +0200 Subject: [PATCH 08/15] Removed Tracker.Component --- check-npm.js | 1 - 1 file changed, 1 deletion(-) diff --git a/check-npm.js b/check-npm.js index eff4cfc..b71d90b 100644 --- a/check-npm.js +++ b/check-npm.js @@ -3,5 +3,4 @@ // checkNpmVersions({ // "react": ">=0.14.7 || ^15.0.0-rc.2", // "react-dom": ">=0.14.7 || ^15.0.0-rc.2", -// "tracker-component": "^1.3.13" // }); From e905e4aa97ff6cebcb5fa8cabcf6972c41004df2 Mon Sep 17 00:00:00 2001 From: Sebastian Ilves Date: Fri, 2 Jun 2017 11:22:21 +0200 Subject: [PATCH 09/15] Removed lodash dependency --- imports/accounts_ui.js | 14 ++--- imports/api/server/loginWithoutPassword.js | 5 +- imports/helpers.js | 2 +- imports/login_session.js | 6 +- imports/ui/components/FormMessage.jsx | 6 +- imports/ui/components/LoginForm.jsx | 65 ++++++++++++---------- package.js | 1 - 7 files changed, 53 insertions(+), 46 deletions(-) diff --git a/imports/accounts_ui.js b/imports/accounts_ui.js index 69d6ba1..811026c 100644 --- a/imports/accounts_ui.js +++ b/imports/accounts_ui.js @@ -73,21 +73,21 @@ Accounts.ui.config = function(options) { 'emailPattern', ]; - _.each(_.keys(options), function (key) { - if (!_.contains(VALID_KEYS, key)) + Object.keys(options).forEach(function (key) { + if (!VALID_KEYS.includes(key)) throw new Error("Accounts.ui.config: Invalid key: " + key); }); // Deal with `passwordSignupFields` if (options.passwordSignupFields) { - if (_.contains([ + if ([ "USERNAME_AND_EMAIL", "USERNAME_AND_OPTIONAL_EMAIL", "USERNAME_ONLY", "EMAIL_ONLY", "EMAIL_ONLY_NO_PASSWORD", "USERNAME_AND_EMAIL_NO_PASSWORD" - ], options.passwordSignupFields)) { + ].includes(options.passwordSignupFields)) { Accounts.ui._options.passwordSignupFields = options.passwordSignupFields; } else { @@ -97,7 +97,7 @@ Accounts.ui.config = function(options) { // Deal with `requestPermissions` if (options.requestPermissions) { - _.each(options.requestPermissions, function (scope, service) { + options.requestPermissions.forEach(function (scope, service) { if (Accounts.ui._options.requestPermissions[service]) { throw new Error("Accounts.ui.config: Can't set `requestPermissions` more than once for " + service); } @@ -112,7 +112,7 @@ Accounts.ui.config = function(options) { // Deal with `requestOfflineToken` if (options.requestOfflineToken) { - _.each(options.requestOfflineToken, function (value, service) { + options.requestOfflineToken.forEach(function (value, service) { if (service !== 'google') throw new Error("Accounts.ui.config: `requestOfflineToken` only supported for Google login at the moment."); @@ -127,7 +127,7 @@ Accounts.ui.config = function(options) { // Deal with `forceApprovalPrompt` if (options.forceApprovalPrompt) { - _.each(options.forceApprovalPrompt, function (value, service) { + options.forceApprovalPrompt.forEach(function (value, service) { if (service !== 'google') throw new Error("Accounts.ui.config: `forceApprovalPrompt` only supported for Google login at the moment."); diff --git a/imports/api/server/loginWithoutPassword.js b/imports/api/server/loginWithoutPassword.js index c86e2c1..73c2b20 100644 --- a/imports/api/server/loginWithoutPassword.js +++ b/imports/api/server/loginWithoutPassword.js @@ -58,12 +58,11 @@ Accounts.sendLoginEmail = function (userId, address) { throw new Error("Can't find user"); // pick the first unverified address if we weren't passed an address. if (!address) { - var email = _.find(user.emails || [], - function (e) { return !e.verified; }); + var email = (user.emails || []).find(({ verified }) => !verified); address = (email || {}).address; } // make sure we have a valid address - if (!address || !_.contains(_.pluck(user.emails || [], 'address'), address)) + if (!address || !(user.emails || []).map(({ address }) => address).includes(address)) throw new Error("No such email address for user."); diff --git a/imports/helpers.js b/imports/helpers.js index 2be5fb7..60db363 100644 --- a/imports/helpers.js +++ b/imports/helpers.js @@ -18,7 +18,7 @@ export function getLoginServices() { // backwards-compatibility. services.sort(); - return _.map(services, function(name){ + return services.map(function(name){ return {name: name}; }); }; diff --git a/imports/login_session.js b/imports/login_session.js index 26d38c1..618b0a7 100644 --- a/imports/login_session.js +++ b/imports/login_session.js @@ -30,7 +30,7 @@ const VALID_KEYS = [ ]; export const validateKey = function (key) { - if (!_.contains(VALID_KEYS, key)) + if (!VALID_KEYS.includes(key)) throw new Error("Invalid key in loginButtonsSession: " + key); }; @@ -43,7 +43,7 @@ export const KEY_PREFIX = "Meteor.loginButtons."; Accounts._loginButtonsSession = { set: function(key, value) { validateKey(key); - if (_.contains(['errorMessage', 'infoMessage'], key)) + if (['errorMessage', 'infoMessage'].includes(key)) throw new Error("Don't set errorMessage or infoMessage directly. Instead, use errorMessage() or infoMessage()."); this._set(key, value); @@ -68,7 +68,7 @@ if (Meteor.isClient){ // Accounts.onPageLoadLogin(function (attemptInfo) { // Ignore if we have a left over login attempt for a service that is no longer registered. - if (_.contains(_.pluck(getLoginServices(), "name"), attemptInfo.type)) + if (getLoginServices().map(({ name }) => name).includes(attemptInfo.type)) loginResultCallback(attemptInfo.type, attemptInfo.error); }); diff --git a/imports/ui/components/FormMessage.jsx b/imports/ui/components/FormMessage.jsx index b5fcb4e..112bfee 100644 --- a/imports/ui/components/FormMessage.jsx +++ b/imports/ui/components/FormMessage.jsx @@ -1,6 +1,10 @@ import React from 'react'; import { Accounts } from 'meteor/accounts-base'; +function isObject(obj) { + return obj === Object(obj); +} + export class FormMessage extends React.Component { render () { let { message, type, className = "message", style = {}, deprecated } = this.props; @@ -9,7 +13,7 @@ export class FormMessage extends React.Component { // Found backwords compatibility issue. console.warn('You are overriding Accounts.ui.Form and using FormMessage, the use of FormMessage in Form has been depreacted in v1.2.11, update your implementation to use FormMessages: https://github.com/studiointeract/accounts-ui/#deprecations'); } - message = _.isObject(message) ? message.message : message; // If message is object, then try to get message from it + message = isObject(message) ? message.message : message; // If message is object, then try to get message from it return message ? (
{ message }
diff --git a/imports/ui/components/LoginForm.jsx b/imports/ui/components/LoginForm.jsx index 093a50f..36e5fa0 100644 --- a/imports/ui/components/LoginForm.jsx +++ b/imports/ui/components/LoginForm.jsx @@ -18,6 +18,14 @@ import { capitalize } from '../../helpers.js'; +function indexBy(array, key) { + const result = {}; + array.forEach(function(obj) { + result[obj[key]] = obj; + }); + return result; +} + class LoginForm extends Component { constructor(props) { super(props); @@ -222,11 +230,11 @@ class LoginForm extends Component { } if (hasPasswordService() && formState == STATES.SIGN_IN) { - if (_.contains([ + if ([ "USERNAME_AND_EMAIL", "USERNAME_AND_OPTIONAL_EMAIL", "USERNAME_AND_EMAIL_NO_PASSWORD" - ], passwordSignupFields())) { + ].includes(passwordSignupFields())) { loginFields.push(this.getUsernameOrEmailField()); } @@ -234,48 +242,48 @@ class LoginForm extends Component { loginFields.push(this.getUsernameField()); } - if (_.contains([ + if ([ "EMAIL_ONLY", "EMAIL_ONLY_NO_PASSWORD" - ], passwordSignupFields())) { + ].includes(passwordSignupFields())) { loginFields.push(this.getEmailField()); } - if (!_.contains([ + if (![ "EMAIL_ONLY_NO_PASSWORD", "USERNAME_AND_EMAIL_NO_PASSWORD" - ], passwordSignupFields())) { + ].includes(passwordSignupFields())) { loginFields.push(this.getPasswordField()); } } if (hasPasswordService() && formState == STATES.SIGN_UP) { - if (_.contains([ + if ([ "USERNAME_AND_EMAIL", "USERNAME_AND_OPTIONAL_EMAIL", "USERNAME_ONLY", "USERNAME_AND_EMAIL_NO_PASSWORD" - ], passwordSignupFields())) { + ].includes(passwordSignupFields())) { loginFields.push(this.getUsernameField()); } - if (_.contains([ + if ([ "USERNAME_AND_EMAIL", "EMAIL_ONLY", "EMAIL_ONLY_NO_PASSWORD", "USERNAME_AND_EMAIL_NO_PASSWORD" - ], passwordSignupFields())) { + ].includes(passwordSignupFields())) { loginFields.push(this.getEmailField()); } - if (_.contains(["USERNAME_AND_OPTIONAL_EMAIL"], passwordSignupFields())) { + if (["USERNAME_AND_OPTIONAL_EMAIL"].includes(passwordSignupFields())) { loginFields.push(Object.assign(this.getEmailField(), {required: false})); } - if (!_.contains([ + if (![ "EMAIL_ONLY_NO_PASSWORD", "USERNAME_AND_EMAIL_NO_PASSWORD" - ], passwordSignupFields())) { + ].includes(passwordSignupFields())) { loginFields.push(this.getPasswordField()); } } @@ -294,8 +302,7 @@ class LoginForm extends Component { if (this.showEnrollAccountForm()) { loginFields.push(this.getSetPasswordField()); } - - return _.indexBy(loginFields, 'id'); + return indexBy(loginFields, 'id'); } buttons() { @@ -349,10 +356,10 @@ class LoginForm extends Component { }); } - if (user && !_.contains([ + if (user && ![ "EMAIL_ONLY_NO_PASSWORD", "USERNAME_AND_EMAIL_NO_PASSWORD" - ], passwordSignupFields()) + ].includes(passwordSignupFields()) && formState == STATES.PROFILE && (user.services && 'password' in user.services)) { loginButtons.push({ @@ -433,7 +440,7 @@ class LoginForm extends Component { b.type != undefined); }); - return _.indexBy(loginButtons, 'id'); + return indexBy(loginButtons, 'id'); } showSignInLink(){ @@ -457,9 +464,7 @@ class LoginForm extends Component { showForgotPasswordLink() { return !this.props.user && this.state.formState == STATES.SIGN_IN - && _.contains( - ["USERNAME_AND_EMAIL", "USERNAME_AND_OPTIONAL_EMAIL", "EMAIL_ONLY"], - passwordSignupFields()); + && ["USERNAME_AND_EMAIL", "USERNAME_AND_OPTIONAL_EMAIL", "EMAIL_ONLY"].includes(passwordSignupFields()); } /** @@ -585,7 +590,7 @@ class LoginForm extends Component { error = true; } else { - if (_.contains([ "USERNAME_AND_EMAIL_NO_PASSWORD" ], passwordSignupFields())) { + if (["USERNAME_AND_EMAIL_NO_PASSWORD"].includes(passwordSignupFields())) { this.loginWithoutPassword(); return; } else { @@ -608,7 +613,7 @@ class LoginForm extends Component { error = true; } else { - if (_.contains([ "EMAIL_ONLY_NO_PASSWORD" ], passwordSignupFields())) { + if (["EMAIL_ONLY_NO_PASSWORD"].includes(passwordSignupFields())) { this.loginWithoutPassword(); error = true; } else { @@ -616,7 +621,7 @@ class LoginForm extends Component { } } } - if (!_.contains([ "EMAIL_ONLY_NO_PASSWORD" ], passwordSignupFields()) + if (!["EMAIL_ONLY_NO_PASSWORD"].includes(passwordSignupFields()) && !this.validateField('password', password)) { error = true; } @@ -656,7 +661,7 @@ class LoginForm extends Component { }); } } - return _.indexBy(oauthButtons, 'id'); + return indexBy(oauthButtons, 'id'); } oauthSignIn(serviceName) { @@ -720,10 +725,10 @@ class LoginForm extends Component { options.username = username; } } else { - if (_.contains([ + if ([ "USERNAME_AND_EMAIL", "USERNAME_AND_EMAIL_NO_PASSWORD" - ], passwordSignupFields()) && !this.validateField('username', username) ) { + ].includes(passwordSignupFields()) && !this.validateField('username', username) ) { if (this.state.formState == STATES.SIGN_UP) { this.state.onSubmitHook("error.accounts.usernameRequired", this.state.formState); } @@ -737,10 +742,10 @@ class LoginForm extends Component { options.email = email; } - if (_.contains([ + if ([ "EMAIL_ONLY_NO_PASSWORD", "USERNAME_AND_EMAIL_NO_PASSWORD" - ], passwordSignupFields())) { + ].includes(passwordSignupFields())) { // Generate a random password. options.password = Meteor.uuid(); } else if (!this.validateField('password', password)) { @@ -829,7 +834,7 @@ class LoginForm extends Component { }); } else { let errMsg = null; - if (_.contains([ "USERNAME_AND_EMAIL_NO_PASSWORD" ], passwordSignupFields())) { + if (["USERNAME_AND_EMAIL_NO_PASSWORD"].includes(passwordSignupFields())) { errMsg = this.translate("error.accounts.invalid_email"); } else { diff --git a/package.js b/package.js index a082c9b..258ac90 100644 --- a/package.js +++ b/package.js @@ -10,7 +10,6 @@ Package.onUse(function(api) { api.versionsFrom('1.3'); api.use('ecmascript'); api.use('tracker'); - api.use('underscore'); api.use('accounts-base'); api.use('check'); api.use('random'); From 1ff90cdc1b92c6dd59e85e78c4c2c54e166d5ccb Mon Sep 17 00:00:00 2001 From: Sebastian Ilves Date: Fri, 2 Jun 2017 11:23:04 +0200 Subject: [PATCH 10/15] Removed tracker dependency --- package.js | 1 - 1 file changed, 1 deletion(-) diff --git a/package.js b/package.js index 258ac90..d3ef0a5 100644 --- a/package.js +++ b/package.js @@ -9,7 +9,6 @@ Package.describe({ Package.onUse(function(api) { api.versionsFrom('1.3'); api.use('ecmascript'); - api.use('tracker'); api.use('accounts-base'); api.use('check'); api.use('random'); From 44f2b1dba23f69c93843c8fc70b199aa17a18036 Mon Sep 17 00:00:00 2001 From: Sebastian Ilves Date: Fri, 2 Jun 2017 11:24:33 +0200 Subject: [PATCH 11/15] Updated Changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36c5194..ce7cf27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # ChangeLog +### v1.2.22 +01-Jun-2017 + +* Removed lodash dependency. +* Removed tracker dependency. + ### v1.2.21 26-May-2017 From d4f5fb941bc425cf219621d705441bcd404a508f Mon Sep 17 00:00:00 2001 From: Sebastian Ilves Date: Fri, 2 Jun 2017 14:09:12 +0200 Subject: [PATCH 12/15] 1.2.22 --- package.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.js b/package.js index d3ef0a5..d60393c 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'std:accounts-ui', - version: '1.2.21', + version: '1.2.22', summary: 'Accounts UI for React in Meteor 1.3+', git: 'https://github.com/studiointeract/accounts-ui', documentation: 'README.md' From b046af39ba6e16bcb105b3046c03b40d29fd8d74 Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Thu, 15 Jun 2017 13:43:45 +0200 Subject: [PATCH 13/15] Fixed issue with faulty object iteration. --- imports/accounts_ui.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/imports/accounts_ui.js b/imports/accounts_ui.js index 811026c..9bf74d4 100644 --- a/imports/accounts_ui.js +++ b/imports/accounts_ui.js @@ -97,7 +97,8 @@ Accounts.ui.config = function(options) { // Deal with `requestPermissions` if (options.requestPermissions) { - options.requestPermissions.forEach(function (scope, service) { + Object.keys(options.requestPermissions).forEach(service => { + const score = options.requestPermissions[service]; if (Accounts.ui._options.requestPermissions[service]) { throw new Error("Accounts.ui.config: Can't set `requestPermissions` more than once for " + service); } @@ -112,7 +113,8 @@ Accounts.ui.config = function(options) { // Deal with `requestOfflineToken` if (options.requestOfflineToken) { - options.requestOfflineToken.forEach(function (value, service) { + Object.keys(options.requestOfflineToken).forEach(service => { + const value = options.requestOfflineToken[service]; if (service !== 'google') throw new Error("Accounts.ui.config: `requestOfflineToken` only supported for Google login at the moment."); @@ -127,7 +129,8 @@ Accounts.ui.config = function(options) { // Deal with `forceApprovalPrompt` if (options.forceApprovalPrompt) { - options.forceApprovalPrompt.forEach(function (value, service) { + Object.keys(options.forceApprovalPrompt).forEach(service => { + const value = options.forceApprovalPrompt[service]; if (service !== 'google') throw new Error("Accounts.ui.config: `forceApprovalPrompt` only supported for Google login at the moment."); From 8e45bdfa4a79d97e2e5b11696c887ba2ecbfc379 Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Thu, 15 Jun 2017 14:05:27 +0200 Subject: [PATCH 14/15] Fixed issue with faulty formState proptype. --- imports/ui/components/LoginForm.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imports/ui/components/LoginForm.jsx b/imports/ui/components/LoginForm.jsx index 36e5fa0..7593083 100644 --- a/imports/ui/components/LoginForm.jsx +++ b/imports/ui/components/LoginForm.jsx @@ -1005,7 +1005,7 @@ class LoginForm extends Component { } } LoginForm.propTypes = { - formState: PropTypes.string, + formState: PropTypes.symbol, loginPath: PropTypes.string, signUpPath: PropTypes.string, resetPasswordPath: PropTypes.string, From 02fc0185338237bcd69ad900ba33b3d5f11b6b3f Mon Sep 17 00:00:00 2001 From: Tim Brandin Date: Thu, 15 Jun 2017 14:08:03 +0200 Subject: [PATCH 15/15] v1.2.22 --- .versions | 2 +- CHANGELOG.md | 4 +++- README.md | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.versions b/.versions index d5d2868..f32a343 100644 --- a/.versions +++ b/.versions @@ -51,7 +51,7 @@ session@1.1.7 softwarerero:accounts-t9n@1.3.3 spacebars@1.0.12 spacebars-compiler@1.0.12 -std:accounts-ui@1.2.21 +std:accounts-ui@1.2.22 tmeasday:check-npm-versions@0.3.0 tracker@1.1.3 ui@1.0.11 diff --git a/CHANGELOG.md b/CHANGELOG.md index ce7cf27..45ee572 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,10 @@ # ChangeLog ### v1.2.22 -01-Jun-2017 +15-Jun-2017 +* Fixed issue with faulty formState proptype. +* Fixed issue with faulty object iteration. * Removed lodash dependency. * Removed tracker dependency. diff --git a/README.md b/README.md index 4b3f99e..adfc1ea 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # React Accounts UI -Current version 1.2.21 +Current version 1.2.22 ## Features