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

Email confirmation can be enabled without setting SMTP settings #766

Closed
Morgul opened this issue Sep 11, 2015 · 18 comments
Closed

Email confirmation can be enabled without setting SMTP settings #766

Morgul opened this issue Sep 11, 2015 · 18 comments

Comments

@Morgul
Copy link
Contributor

Morgul commented Sep 11, 2015

I was playing around with setting up an install of RocketChat, and I enabled email verification. However, I didn't get around to setting up my SMTP settings, and then (for other reasons), logged out. Now, I can't ever get back in, because it requires me to confirm my email, something I can never do without an SMTP server configured.

This is definitely an edge case, but new users just playing around with the system (like myself) seem likely to make mistakes like this. In short, you should never be able to lock yourself out while setting up a new install.

As a secondary question: once a user's been created (like my admin user), why would enabling email confirmation then require that user to confirm it's email? The user's already been made; email confirmation should only be for new accounts, right?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@Morgul
Copy link
Contributor Author

Morgul commented Sep 11, 2015

Additionally, I'd also take some suggestions on recovering from this state. ;)

@k0nsl
Copy link
Contributor

k0nsl commented Sep 11, 2015

@Morgul:

This may not be the most optimal solution, but wouldn't it be possible to export the values for SMTP and have them set up using something like Mandrill?

Export these: SMTP_Host, SMTP_Port, SMTP_Username and SMTP_Password.

I have not tested that, but logically it should work.

@graywolf336
Copy link
Contributor

@Morgul if you have database access, you can set yourself as email verified or change the setting in the database. db.getCollection('rocketchat_settings').find({ _id: 'Accounts_EmailVerification' }) and then set the value field to false.

@Morgul
Copy link
Contributor Author

Morgul commented Sep 11, 2015

@graywolf336 I'm running it in a docker, I'll look up the docker commands to get access to the DB, shouldn't be hard. Thanks.

@k0nsl I'm not sure I follow?Are you suggesting as a way to work around my current install being locked out, or as a way to allow users to fix this problem if they run into it?

My thought for a general solution, not knowing the code, is basically having the radio buttons for enabling email verification disabled if there's nothing set in the SMTP_* fields. I'd imagine it's a straightforward change, though I'd say this is definitely a candidate for a 'papercut' label.

@Morgul
Copy link
Contributor Author

Morgul commented Sep 11, 2015

@graywolf336 Updating the database worked like a charm.

For posterity, this is what I had to do:

Log into docker

$ docker exec -i -t <<docker_mongo_container_name>> bash

Update the database

root@65ca236a61c7:/# mongo
MongoDB shell version: 3.0.6
connecting to: test
> use rocketchat
switched to db rocketchat
> db.getCollection('rocketchat_settings').find({ _id: 'Accounts_EmailVerification' })
{ "_id" : "Accounts_EmailVerification", "value" : true, "i18nLabel" : "Accounts_EmailVerification", "i18nDescription" : null, "type" : "boolean", "group" : "Accounts", "section" : "Registration", "public" : true }
> db.getCollection('rocketchat_settings').update({ _id: 'Accounts_EmailVerification' }, { $set: { value: false } })
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
> db.getCollection('rocketchat_settings').find({ _id: 'Accounts_EmailVerification' })
{ "_id" : "Accounts_EmailVerification", "value" : false, "i18nLabel" : "Accounts_EmailVerification", "i18nDescription" : null, "type" : "boolean", "group" : "Accounts", "section" : "Registration", "public" : true }

That's it! It worked great.

@graywolf336
Copy link
Contributor

@Morgul Glad to hear and thanks for providing the details!

@geekgonecrazy
Copy link
Contributor

@Morgul sweet! Thanks for posting that! :D I had to mess with mongo in docker a few days ago for something similar but forgot to keep the commands I used. This might be something we stash away in a wiki article somewhere.

@Morgul
Copy link
Contributor Author

Morgul commented Sep 11, 2015

@graywolf336 No problem. Love giving back, even in little ways.

@geekgonecrazy Actually, it'd be nice to beef up the docs for docker usage a bit more. Docker's become my new favorite deployment tool, so the more docker love in the docs, the better.

Heck, I even had a crazy idea for a sh script that takes the local port to bind to, restart strategy and then pulls the docker-compose.yml from the repo, modifies it and streams it into docker-compose up -d. It would turn deploying it via docker into a one liner. Could even serve it off http://get.rocket.chat But, that's getting pretty off topic. ;)

@geekgonecrazy
Copy link
Contributor

<3 docker. I'd love to hear what you have in mind! Sounds cool. Feel free to start an issue and brain storm away. :)

@Morgul
Copy link
Contributor Author

Morgul commented Sep 11, 2015

@geekgonecrazy Opened #770. :)

Out of curiosity, does More information needed mean you need more information from me? If so, what?

@geekgonecrazy
Copy link
Contributor

Probably need a new tag. :). Just wanted to mark it that we needed to discuss implementation potentially

@Morgul
Copy link
Contributor Author

Morgul commented Sep 11, 2015

@geekgonecrazy On my projects, I use a Discussion Needed or Feedback Requested label. :)

@tholu
Copy link
Contributor

tholu commented Nov 24, 2015

@Morgul Thanks for the detailed steps, I was able to restore my login quickly.

@Morgul
Copy link
Contributor Author

Morgul commented Nov 24, 2015

@tholu no problem. :)

Sing-Li added a commit that referenced this issue Nov 30, 2015
Most SMTP servers will only accept valid email address for sender. #766
@adrianb88
Copy link

@Morgul hi. I am a beginner and have no experience with databases. Maybe you can help?
I recently deployed or created an account with rocket.chat via https://rocket.chat/deploy
As already mentioned in your first post from 11th September, I didn't configure any smtp and as an admin "kicked my self out..." because the email confirmation isn't working at all for me (although I am an admin...)
In other words I have no access at all.

Any ideas how I can solve this issue manually?
Btw. I am not using docker etc so I have no access to any database.

@tholu
Copy link
Contributor

tholu commented Dec 2, 2015

@adrianb88 If you are not using docker, you should have direct access to the mongo database. Or what are you using?

@adrianb88
Copy link

@tholu hi, well the thing is, I only deployed directly via rocket.chat/deploy and that's it. It worked just fine until I locked my self out (e.g. cannot login in via my client).

@tholu
Copy link
Contributor

tholu commented Dec 2, 2015

@adrianb88 Where exactly did you deploy it? Heroku?

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

No branches or pull requests

9 participants