Last Comment Bug 346263 - While changing account settings for an IMAP mail account, I was not allowed to change the case of either the username or servername
: While changing account settings for an IMAP mail account, I was not allowed t...
Status: RESOLVED FIXED
:
Product: MailNews Core
Classification: Components
Component: Account Manager (show other bugs)
: Trunk
: All All
: -- minor (vote)
: Thunderbird 15.0
Assigned To: :aceman
:
Mentors:
Depends on:
Blocks: 238583
  Show dependency treegraph
 
Reported: 2006-07-28 03:10 PDT by Andrew Kositsky
Modified: 2012-05-14 15:35 PDT (History)
6 users (show)
ryanvm: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
patch (4.73 KB, patch)
2012-04-29 15:43 PDT, :aceman
iann_bugzilla: review-
Details | Diff | Review
patch v2 (4.72 KB, patch)
2012-05-02 14:51 PDT, :aceman
iann_bugzilla: review+
mconley: review+
Details | Diff | Review
patch v3 (4.85 KB, patch)
2012-05-14 14:02 PDT, :aceman
acelists: review+
Details | Diff | Review

Description Andrew Kositsky 2006-07-28 03:10:07 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4
Build Identifier: Thunderbird/version 1.5.0.5 (20060719)

While changing account settings for an IMAP mail account, I was not allowed to change the case of either the username or servername.

I got an error message

"An account with that user name and server name already exists. Please enter a different user name and/or server name."

even though I was changing the account to which the error message is refering.  If I change the server or user name (say by putting in an extra letter,) I can then change back to the original server or user name in whatever case I want.

Reproducible: Always

Steps to Reproduce:
1. set up a new IMAP mail account with some arbitrary user name and server name (e.g. user name = bob, server name = incoming mail server = foo.bar.com)
2. Close account settings (this step may or may not be necessary; saving may be all that is necessary.)
3. reopen account settings, go to server settings on the account in question
4. try to change Server Name from "foo.bar.com" to "Foo.bar.com"

Actual Results:  
I received the error:
"An account with that user name and server name already exists. Please enter a different user name and/or server name."

Expected Results:  
The software should allow changing the case of server names.

standard installation of windows XP, default everything in Thunderbird (as for as I know)
Comment 1 Nikolay Shopik 2008-04-10 13:24:26 PDT
exist on version 3.0a1pre (2008040903)
Comment 2 :aceman 2012-02-11 18:28:27 PST
Interestingly, if you change case of both server and username, that change will be allowed.

There is a check to disallow setting server+user combination to the same combination existing in other account. But in the report it looks like the combination in one account is colliding with itself. I'll look into this.
Comment 3 :aceman 2012-04-29 15:43:42 PDT
Created attachment 619452 [details] [diff] [review]
patch

This should do it. No visual changes intended.
Comment 4 Ian Neal 2012-05-02 14:11:22 PDT
Comment on attachment 619452 [details] [diff] [review]
patch

On code inspection only, no testing as yet.
>+      let changeText = "";
>+      if ((oldHost != newHost) &&
>+          (filterList != undefined) && filterList.filterCount)
>+        changeText = prefBundle.getString("serverNameChanged");
>       if (oldUser != newUser)
>+        changeText = changeText + "\n\n" + prefBundle.getString("userNameChanged");
Don't you need to check that changeText is not "" before adding "\n\n" otherwise your alert will have two new lines at the beginning?
Comment 5 :aceman 2012-05-02 14:16:42 PDT
There were tons of checks before but I found them superfluous.
The .trim will take care of the leading newlines.
Comment 6 Ian Neal 2012-05-02 14:33:32 PDT
(In reply to :aceman from comment #5)
> There were tons of checks before but I found them superfluous.
> The .trim will take care of the leading newlines.

Sorry, I missed that last change.
I believe it should be changeText.trim() not String.trim(changeText)
Comment 7 :aceman 2012-05-02 14:51:08 PDT
Created attachment 620476 [details] [diff] [review]
patch v2

Both ways seem to work.
Comment 8 Mike Conley (:mconley) - (needinfo me!) 2012-05-14 13:31:13 PDT
Comment on attachment 620476 [details] [diff] [review]
patch v2

Review of attachment 620476 [details] [diff] [review]:
-----------------------------------------------------------------

Just two nits - but otherwise, from inspection, this looks good.

Great work, as usual.

::: mailnews/base/prefs/content/AccountManager.js
@@ +259,5 @@
> + * Check if the user and/or host names have been changed and if so check
> + * if the new names already exists for an account or are empty.
> + * Also check if the Local Directory path was changed.
> + *
> + * @param showAlert  show and alert if any problem with server/user name is found?

I think I'd prefer this @param def'n to be:

show an alert if a problem with the host / user name is found.

@@ +360,1 @@
>  

Let's put a comment here saying that any extraneous whitespace will be trimmed off before showing the message.
Comment 9 :aceman 2012-05-14 14:02:13 PDT
Created attachment 623803 [details] [diff] [review]
patch v3

Thanks, done.
Comment 10 Ryan VanderMeulen [:RyanVM] 2012-05-14 15:35:45 PDT
https://hg.mozilla.org/comm-central/rev/81a3ad828425

Note You need to log in before you can comment on or make changes to this bug.