From 23c8a4c3c3c34057be0a44fa8f9c6c6a6e04b628 Mon Sep 17 00:00:00 2001 From: themeteorchef Date: Thu, 3 Nov 2016 19:22:27 -0500 Subject: [PATCH] remove dependency on getInputValue() from form modules --- imports/modules/login.js | 9 ++++----- imports/modules/recover-password.js | 7 +++---- imports/modules/reset-password.js | 7 +++---- imports/modules/signup.js | 17 ++++++++--------- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/imports/modules/login.js b/imports/modules/login.js index 3842dca..f5ce896 100644 --- a/imports/modules/login.js +++ b/imports/modules/login.js @@ -3,13 +3,12 @@ import 'jquery-validation'; import { browserHistory } from 'react-router'; import { Meteor } from 'meteor/meteor'; import { Bert } from 'meteor/themeteorchef:bert'; -import { getInputValue } from './get-input-value'; let component; const login = () => { - const email = getInputValue(component.refs.emailAddress); - const password = getInputValue(component.refs.password); + const email = document.querySelector('[name="emailAddress"]').value; + const password = document.querySelector('[name="password"]').value; Meteor.loginWithPassword(email, password, (error) => { if (error) { @@ -51,7 +50,7 @@ const validate = () => { }); }; -export const handleLogin = (options) => { +export default function handleLogin(options) { component = options.component; validate(); -}; +} diff --git a/imports/modules/recover-password.js b/imports/modules/recover-password.js index e2c846b..3f1004b 100644 --- a/imports/modules/recover-password.js +++ b/imports/modules/recover-password.js @@ -2,13 +2,12 @@ import $ from 'jquery'; import 'jquery-validation'; import { Accounts } from 'meteor/accounts-base'; import { Bert } from 'meteor/themeteorchef:bert'; -import { getInputValue } from './get-input-value'; let component; const handleRecovery = () => { Accounts.forgotPassword({ - email: getInputValue(component.refs.emailAddress), + email: document.querySelector('[name="emailAddress"]').value, }, (error) => { if (error) { Bert.alert(error.reason, 'warning'); @@ -36,7 +35,7 @@ const validate = () => { }); }; -export const handleRecoverPassword = (options) => { +export default function handleRecoverPassword(options) { component = options.component; validate(); -}; +} diff --git a/imports/modules/reset-password.js b/imports/modules/reset-password.js index 9d18e9b..5906271 100644 --- a/imports/modules/reset-password.js +++ b/imports/modules/reset-password.js @@ -3,13 +3,12 @@ import 'jquery-validation'; import { browserHistory } from 'react-router'; import { Accounts } from 'meteor/accounts-base'; import { Bert } from 'meteor/themeteorchef:bert'; -import { getInputValue } from './get-input-value'; let component; let token; const handleReset = () => { - const password = getInputValue(component.refs.newPassword); + const password = document.querySelector('[name="newPassword"]').value; Accounts.resetPassword(token, password, (error) => { if (error) { Bert.alert(error.reason, 'danger'); @@ -47,8 +46,8 @@ const validate = () => { }); }; -export const handleResetPassword = (options) => { +export default function handleResetPassword(options) { component = options.component; token = options.token; validate(); -}; +} diff --git a/imports/modules/signup.js b/imports/modules/signup.js index 499ca4a..c45478a 100644 --- a/imports/modules/signup.js +++ b/imports/modules/signup.js @@ -3,22 +3,21 @@ import 'jquery-validation'; import { browserHistory } from 'react-router'; import { Accounts } from 'meteor/accounts-base'; import { Bert } from 'meteor/themeteorchef:bert'; -import { getInputValue } from './get-input-value'; let component; const getUserData = () => ({ - email: getInputValue(component.refs.emailAddress), - password: getInputValue(component.refs.password), + email: document.querySelector('[name="emailAddress"]').value, + password: document.querySelector('[name="password"]').value, profile: { name: { - first: getInputValue(component.refs.firstName), - last: getInputValue(component.refs.lastName), + first: document.querySelector('[name="firstName"]').value, + last: document.querySelector('[name="lastName"]').value, }, }, }); -const signUp = () => { +const signup = () => { const user = getUserData(); Accounts.createUser(user, (error) => { @@ -65,11 +64,11 @@ const validate = () => { minlength: 'Use at least six characters, please.', }, }, - submitHandler() { signUp(); }, + submitHandler() { signup(); }, }); }; -export const handleSignup = (options) => { +export default function handleSignup(options) { component = options.component; validate(); -}; +} -- 2.0.0