Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/email settings change accounts ui #1770

Merged
merged 24 commits into from
Oct 13, 2016

Conversation

brylie
Copy link
Contributor

@brylie brylie commented Oct 12, 2016

Closes #1725
Closes #1727
Closes #1719
Closes #1742

Changes

  • conditionally change Accounts Templates links and features based on email settings
    • showForgotPasswordLink
    • showResendVerificationEmailLink
  • move login_verify.js to users module
    • fix startup.js import
    • refactor and lint file
    • remove call to loginAttemptVerifier setting from AutoForm
  • fix env.MAIL_URL template string to remove newlines

Rationale

We probably only need to set the loginAttemptVerifier on startup, and update the function to handle our use cases:

  • email settings enabled
  • email settings not enabled

@brylie brylie added this to the Sprint 33 milestone Oct 12, 2016
@bajiat
Copy link
Contributor

bajiat commented Oct 13, 2016

@marla-singer Can you mentor and review?

@marla-singer
Copy link
Contributor

@bajiat Yes

@marla-singer
Copy link
Contributor

@brylie A suggestion received from @jykae about admin verification.
There are checking if user is in role admin, not updating verified if it is not really verified.
Use Roles.userIsInRole(userId, ['admin']); in this part

// Find user email & callback check if it's verified

@@ -9,6 +9,24 @@ import { loginAttemptVerifier } from '/core/helper_functions/login_verify';
import { Settings } from '../collection';

Meteor.methods({
configureSmtpSettings (settings) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to call this function on startup to set MAIL_URL env variable if process is killed and restarted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not currently doing that. Is it an issue right now?

}

// If email is verified and parameters.allowed is true, user login is allowed
if (verified && parameters.allowed) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't understand why do you check verified and parameters.allowed? If user has verified as true and allowed as false, why login not allowed?

Copy link
Contributor Author

@brylie brylie Oct 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marla-singer I am not sure what parameters.allowed means. Where does it come from? It was part of the code before I started working here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brylie I dont' know too. But looks very strange

@marla-singer
Copy link
Contributor

@brylie Don't forget to add condition for showForgotPasswordLink and showResendVerificationEmailLink. Now it isn't so.

joxi_screenshot_1476365718831

@brylie
Copy link
Contributor Author

brylie commented Oct 13, 2016

Thanks @marla-singer. Right now, I am not even able to get verification emails to send, so need to work on the links after sending works.

@brylie
Copy link
Contributor Author

brylie commented Oct 13, 2016

I am getting a server console error when creating a new user, with email validation enabled:

Exception in setTimeout callback: Error: connect ECONNREFUSED 104.130.177.23:25
     at Object.Future.wait (/home/brylie/.meteor/packages/meteor-tool/.1.4.1_1.139xb76++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:449:15)
     at smtpSend (packages/email/email.js:89:1)
     at Object.Email.send (packages/email/email.js:192:1)
     at AccountsServer.Accounts.sendVerificationEmail (packages/accounts-password/password_server.js:802:9)
     at [object Object].sendRegistrationEmailVerification (users/server/methods.js:34:16)
     at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1711:12)
     at packages/ddp-server/livedata_server.js:1624:18
     at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
     at Server.apply (packages/ddp-server/livedata_server.js:1623:45)
     at Server.call (packages/ddp-server/livedata_server.js:1566:17)
     - - - - -
     at Object.exports._errnoException (util.js:907:11)
     at exports._exceptionWithHostPort (util.js:930:20)
     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1077:14)

This may be related to the Mailgun SMTP port. I have tried:

  • 25
  • 465
  • 587

@brylie
Copy link
Contributor Author

brylie commented Oct 13, 2016

The above console error may be related to the email from_address.

http://stackoverflow.com/questions/32104047/meteor-cant-send-emails-sendererror-mail-from-command-failed-501-syntax-er

However, since I am not calling Email.send directly, I am not sure how to properly set the from_address for Accounts.sendVerificationEmail().

@jykae
Copy link
Contributor

jykae commented Oct 13, 2016

@brylie 587 did work for Mailgun when I worked with it earlier.
http://blog.mailgun.com/25-465-587-what-port-should-i-use/

@marla-singer
Copy link
Contributor

@brylie Sending emails work! I used the free russian smtp server and got email 👍 But it was appeared in spam

@jykae
Copy link
Contributor

jykae commented Oct 13, 2016

@marla-singer
Copy link
Contributor

marla-singer commented Oct 13, 2016

@brylie "Email address for sending emails" isn't updated in users emails.
For instance, the first values was old_mail@mail.com, the second one is new_mail@mail.com
After changing I created another user, but got email from old_mail@mail.com.

@marla-singer
Copy link
Contributor

marla-singer commented Oct 13, 2016

Try to login as un-exist user.

Found: Message with text "Interval server error" and server console error Exception while invoking method 'login' TypeError: Cannot read property '_id' of undefined

Expected: Message with text "Login forbidden"

@brylie
Copy link
Contributor Author

brylie commented Oct 13, 2016

Try to login as un-exist user.

Found: Message with text "Interval server error" and console error Exception while invoking method 'login' TypeError: Cannot read property '_id' of undefined

Expected: Message with text "Login forbidden"

@marla-singer please file the last comment as a new issue. It may not be in the scope of this issue.

@brylie
Copy link
Contributor Author

brylie commented Oct 13, 2016

"Email address for sending emails" isn't updated in users emails.

That might be fixed in commit a5f5b4c

@marla-singer
Copy link
Contributor

marla-singer commented Oct 13, 2016

please file the last comment as a new issue. It may not be in the scope of this issue

We have message with text "Login forbidden" on nightly and staging but don't in this branch

@brylie
Copy link
Contributor Author

brylie commented Oct 13, 2016

I get login forbidden when I try logging in as a non-existant user.

screenshot_20161013_175043

@marla-singer
Copy link
Contributor

Okay, maybe something's wrong on my side

@brylie
Copy link
Contributor Author

brylie commented Oct 13, 2016

Cool. I am not sure what it might be, but will gladly fix it if it is a bug I've introduced.

@marla-singer
Copy link
Contributor

Great! Commit a5f5b4c fixed problem

@jykae
Copy link
Contributor

jykae commented Oct 13, 2016

@brylie AccountsTemplates might need init after setting them, if we change them.
meteor-useraccounts/core#159

@brylie
Copy link
Contributor Author

brylie commented Oct 13, 2016

Note: we cannot configure AccountsTemplates settings after they have been initialized:

Update mail configuration: Error: Configuration options must be set before AccountsTemplates.init!

We have to figure out a different solution, as part of another PR.

@bajiat
Copy link
Contributor

bajiat commented Oct 13, 2016

We will not fix the links for this release. We must have email enabled
anyway for our production version.

@jykae
Copy link
Contributor

jykae commented Oct 13, 2016

yep, agreed

@marla-singer
Copy link
Contributor

marla-singer commented Oct 13, 2016

@brylie "Verification email lost?" works, "Reset password" works.
These links didn't disappear when I disabled mail settings, but let's create another issue for that
Merge?

@bajiat
Copy link
Contributor

bajiat commented Oct 13, 2016

Yes, we need to create another issue for that. And can't fix it for
Mindtrek. Is everything else working now?

@marla-singer marla-singer merged commit d463e0f into develop Oct 13, 2016
@marla-singer marla-singer deleted the feature/email-settings-change-accounts-ui branch October 13, 2016 15:17
@brylie
Copy link
Contributor Author

brylie commented Oct 14, 2016

I opened an upstream support request, asking how to change AccountsTemplates configuration after it has been initialized:

meteor-useraccounts/core#722

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants