Chromium Code Reviews| Index: ios/chrome/browser/passwords/password_controller.mm |
| diff --git a/ios/chrome/browser/passwords/password_controller.mm b/ios/chrome/browser/passwords/password_controller.mm |
| index fc5d885b3bc2553709c48354ab7457b59e3033a7..54b2125971849a4a9db7485fd60b35e9f5a14f4c 100644 |
| --- a/ios/chrome/browser/passwords/password_controller.mm |
| +++ b/ios/chrome/browser/passwords/password_controller.mm |
| @@ -692,36 +692,38 @@ bool GetPageURLAndCheckTrustLevel(web::WebState* web_state, GURL* page_url) { |
| break; |
| case 2: { |
| if (values[0] == values[1]) { |
|
dvadym
2016/07/05 15:42:18
Could you please add check if values are empty as
Jackie Quinn
2016/07/06 07:39:28
Done.
|
| - // Treat two identical passwords as a single password. |
| - form->password_element = elements[0]; |
| - form->password_value = values[0]; |
| - } else { |
| - // Assume first is old password, second is new (no choice but to guess). |
| + // Treat two identical passwords as a single password new password, with |
| + // confirmation. This can be either be a sign-up form or a password |
| + // change form that does not ask for a new password. |
| form->new_password_element = elements[0]; |
| form->new_password_value = values[0]; |
| - form->password_element = elements[1]; |
| - form->password_value = values[1]; |
| + } else { |
| + // Assume first is old password, second is new (no choice but to guess). |
| + form->password_element = elements[0]; |
| + form->password_value = values[0]; |
| + form->new_password_element = elements[1]; |
| + form->new_password_value = values[1]; |
| } |
| break; |
| default: |
| if (values[0] == values[1] && values[0] == values[2]) { |
| - // All three passwords the same? Just treat as one and hope. |
| + // All three passwords the same? This does not make sense, do not |
|
dvadym
2016/07/05 15:42:18
Could you please add check if values are empty as
Jackie Quinn
2016/07/06 07:39:28
Done.
|
| + // add the password element. |
| + break; |
| + } else if (values[0] == values[1]) { |
| + // First two the same and the third different implies that the old |
| + // password is the duplicated one. |
| form->password_element = elements[0]; |
| form->password_value = values[0]; |
| - } else if (values[0] == values[1]) { |
| - // Two the same and one different -> old password is the duplicated |
| - // one. |
| - form->new_password_element = elements[0]; |
| - form->new_password_value = values[0]; |
| - form->password_element = elements[2]; |
| - form->password_value = values[2]; |
| + form->new_password_element = elements[2]; |
| + form->new_password_value = values[2]; |
| } else if (values[1] == values[2]) { |
| // Two the same and one different -> new password is the duplicated |
| // one. |
| - form->new_password_element = elements[0]; |
| - form->new_password_value = values[0]; |
| - form->password_element = elements[1]; |
| - form->password_value = values[1]; |
| + form->password_element = elements[0]; |
| + form->password_value = values[0]; |
| + form->new_password_element = elements[1]; |
| + form->new_password_value = values[1]; |
| } else { |
| // Three different passwords, or first and last match with middle |
| // different. No idea which is which, so no luck. |