const onConfirm = (pwd) => { const _onSuccess = (res) => { dispatch(close); swal.success( 'Success', `Data import from ${name} organization has been successfully completed`, ); if (typeof onSuccess === 'function') onSuccess(res); }; if (!pwd) { swal.close(); return dispatch(setErrorText('Password can not be empty')); } const password = SHA256(pwd); // eslint-disable-line new-cap const methodProps = { documentType, password, from, to: organizationId, }; const action = callMethod(importDocuments, methodProps); dispatch(setDataImportInProgress(true)); return dispatch(action).then(_onSuccess).catch((err) => { dispatch(setDataImportInProgress(false)); // Hack to show the error message. Are there better ways to achieve this? Meteor.setTimeout(() => { swal.error(err); }, 1500); }); };
onSubmit: function(insertDoc, updateDoc, currentDoc) { this.event.preventDefault(); // We just needed to make sure, client-side, that the passwords matched. // The server-side just needs a value. delete insertDoc.password_confirm; insertDoc.current_password = SHA256(insertDoc.current_password); Meteor.call("users.update", insertDoc, (error, response) => { if(error) { console.error(error); if(error.reason) { FlashMessages.sendError(error.reason); } else { FlashMessages.sendError(error.message); } this.done(error); return; } FlashMessages.sendSuccess("Account information updated"); FlowRouter.go("harvests"); }); }
function fallbackDefaultAccountSystem(bind, username, password) { if (typeof username === 'string') { if (username.indexOf('@') === -1) { username = { username }; } else { username = { email: username }; } } logger.info('Fallback to default account system', username); const loginRequest = { user: username, password: { digest: SHA256(password), algorithm: 'sha-256', }, }; return Accounts._runLoginHandlers(bind, loginRequest); }