-
Notifications
You must be signed in to change notification settings - Fork 260
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
create a dynamic default account #28
Conversation
appinfo/application.php
Outdated
@@ -43,8 +49,25 @@ public function __construct(array $urlParams = []) { | |||
$container->registerParameter("appName", "mail"); | |||
$container->registerParameter("userFolder", $container->getServer()->getUserFolder($user)); | |||
$container->registerParameter("testSmtp", $testSmtp); | |||
$container->registerParameter("referrer", isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null); | |||
$container->registerParameter("referrer", isset($_SERVER['HTTP_REFERER']) ? : null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- TODO: undo
cc @pierreozoux since you've been waiting for this feature |
|
||
$user = $this->userSession->getUser(); | ||
$this->logger->info('building default account for user ' . $user->getUID()); | ||
$password = $this->crypto->encrypt($this->session->get('mail_default_account_password')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- TODO: check if password is set (admins could set the config after their users logged in)
Sample config
|
8c3a403
to
46184a4
Compare
seems to work. @LukasReschke @jancborchardt @pierreozoux @nextcloud/mail review please :-) |
Hum... Not sure if related to this specific PR, but, I followed instructions from the README to "compile" this PR to test it. at the following step, I get an error:
Can you tell me what I can do to fix it? thanks!
|
Strange. Update to a recent version of node/npm maybe? 🙈 I have node v6.5.0 and npm 3.10.6. NPM can be updated with |
Yes, it is working now, the issue in the README is this line: https://github.com/nextcloud/mail#developer-setup-info should we point to https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions instead? |
Sounds good. If we point to https://nodejs.org/en/download/package-manager/ it's distribution independent Could you please create a simple PR to fix that? :-) |
Ok, again, not sure if related to this PR, but I get the following js error:
And the left side bar is empty, no folders are displayed. |
@pierreozoux that looks unrelated, as I did not touch any of that client-side code. Does building of the master branch work for you? |
Hm, that's actually a 3rd-party file. I've never seen something like that and the build also succeeds on travis. Maybe a environment-specific error? |
46184a4
to
aec8810
Compare
Ok, I used node v6, and it is now working \o/ |
@LukasReschke @jancborchardt mind giving this another test run? :-) |
Yo @LukasReschke can you enable this for us please? ;) |
Be aware that once we have the remember-me functionality back, this way of storing the login password will break. Then the account will magically disappear as soon as the user is logged in again via the remember-me cookie 💩 |
Wait, what? :D So this will break anyway? |
well, not as long as remember-me is broken 🚀 |
@Gomez has the same problem on a production system. @pierreozoux which server/core did you use for testing? |
The way to solve it I guess was to use node v6. |
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@LukasReschke @pierreozoux @rakshazi please go ahead and test it. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that one is really nice!
No problem using the %USERID%
, but I have some problem with the %EMAIL%
... Will double check my configuration.
When I add another mail account, I have some js TypeError problem, but everything works fine when I reload the page... But I reproduce it on master branch as well so, it does not seem related to the PR. Is it a known issue?
(edit) It is indeed a known issue #320, sorry.
/** | ||
* @param MailAccountMapper $mapper | ||
*/ | ||
public function __construct(MailAccountMapper $mapper, IL10N $l10n) { | ||
public function __construct(MailAccountMapper $mapper, IL10N $l10n, | ||
Manager $defaultAccountManager) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the @param
important?
They were not consistent on that file before the PR anyway, so maybe it is not important... but I'm asking coz I am tempted to change some headers on a file I'm changing on another PR 😋
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, of course they should be in sync with the actual parameters of the method :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although one could argue that the @param
annotation has no added value when the parameter is type hinted anyway 😉
I finally got it working with the Actually, my test user had a different email than what was supposed to be (from the config file perspective). Do not know if it's clear... Here is the story of John (my user):
Actually, I thought the But that let me think: is it safe to rely on the user email? (that could be changed by him at any time). Except that, I love that feature! And everything else works perfectly fine for me. |
Yeah, there should be more documentation on how to use this new feature. Regarding the email issue: good catch! I didn't think about that scenario. However, it's the responsibility of the admin to set the default account settings to something that actually makes sense and works. On most instances the %USERID% replacement is all that is actually needed, because you can easily build credentials for a single domain. |
@ChristophWurst Yeah, that could be convenient for that admin indeed. Actually, I don't use LDAP or others on NC. But in that case, can the end user modify his email or is it "forced" by the admin? |
I don't know. |
IMO having a centralized user back-end that is both used by your Nextcloud and IMAP server is the only realistic use case for this feature 😉 |
I agree. Concerning the "Delete account", do you think it could be possible to disable or hide it easily? Everything else worked well for me, it works as expected. 👍 👍 |
Ah yes, we should hide it ofc. |
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Fixed 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 😃
Thanks a bunch for testing and reviewing 😀 |
I did the easy part 😉 |
Just one question... first of all it seems working but what should happen if the email password differs from the NC-Password? |
Yes, a bit of failure tolerance is needed regardless of an automatically created account because any IMAP account can be temporarily unavailable. Luckily, the code in #326 already comes with a bit of tolerance when one of the accounts fails to load. You still see a warning, but other accounts are usable. |
Please, could you release a version with this changes? |
@sim6 sure, as soon as we've got into a more or less stable state again. Currently there are some issues, e.g. with the background synchronization that make your browser freeze in certain circumstances. #326 tackles some of the issues. Any help (bugfixing, testing, issue reporting, reviewing) is very much appreciated. |
Since I'm using 3 different domain name, I would like the login to be the email address of the account. |
Hi, please file a new ticket if you have found bugs and do not comment on old and closed pull requests. Thanks! |
Alternative approach to #3
@LukasReschke this one is for you :-)