OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('options.accounts', function() { | 5 cr.define('options.accounts', function() { |
6 const Event = cr.Event; | 6 const Event = cr.Event; |
7 | 7 |
8 // Email alias only, assuming it's a gmail address. | 8 // Email alias only, assuming it's a gmail address. |
9 // e.g. 'john' | 9 // e.g. 'john' |
10 // {name: 'john', email: 'john@gmail.com'} | 10 // {name: 'john', email: 'john@gmail.com'} |
11 const format1String = | 11 const format1String = |
12 '^\\s*([\\w\\.!#\\$%&\'\\*\\+-\\/=\\?\\^`\\{\\|\\}~]+)\\s*$'; | 12 '^\\s*([\\w\\.!#\\$%&\'\\*\\+-\\/=\\?\\^`\\{\\|\\}~]+)\\s*$'; |
13 // Email address only. | 13 // Email address only. |
14 // e.g. 'john@chromium.org' | 14 // e.g. 'john@chromium.org' |
15 // {name: 'john', email: 'john@chromium.org'} | 15 // {name: 'john', email: 'john@chromium.org'} |
16 const format2String = | 16 const format2String = |
17 '^\\s*([\\w\\.!#\\$%&\'\\*\\+-\\/=\\?\\^`\\{\\|\\}~]+)@(\\w+\\..+)\\s*$'; | 17 '^\\s*([\\w\\.!#\\$%&\'\\*\\+-\\/=\\?\\^`\\{\\|\\}~]+)@' + |
| 18 '([A-Za-z0-9\-]{2,63}\\..+)\\s*$'; |
18 // Full format. | 19 // Full format. |
19 // e.g. '"John Doe" <john@chromium.org>' | 20 // e.g. '"John Doe" <john@chromium.org>' |
20 // {name: 'John doe', email: 'john@chromium.org'} | 21 // {name: 'John doe', email: 'john@chromium.org'} |
21 const format3String = | 22 const format3String = |
22 '^\\s*"{0,1}([^"]+)"{0,1}\\s*<([^@]+@\\w+\\..+)>\\s*$'; | 23 '^\\s*"{0,1}([^"]+)"{0,1}\\s*' + |
| 24 '<([\\w\\.!#\\$%&\'\\*\\+-\\/=\\?\\^`\\{\\|\\}~]+@' + |
| 25 '[A-Za-z0-9\-]{2,63}\\..+)>\\s*$'; |
23 | 26 |
24 /** | 27 /** |
25 * Creates a new user name edit element. | 28 * Creates a new user name edit element. |
26 * @param {Object=} opt_propertyBag Optional properties. | 29 * @param {Object=} opt_propertyBag Optional properties. |
27 * @constructor | 30 * @constructor |
28 * @extends {HTMLInputElement} | 31 * @extends {HTMLInputElement} |
29 */ | 32 */ |
30 var UserNameEdit = cr.ui.define('input'); | 33 var UserNameEdit = cr.ui.define('input'); |
31 | 34 |
32 UserNameEdit.prototype = { | 35 UserNameEdit.prototype = { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 this.select(); | 115 this.select(); |
113 } | 116 } |
114 } | 117 } |
115 }; | 118 }; |
116 | 119 |
117 return { | 120 return { |
118 UserNameEdit: UserNameEdit | 121 UserNameEdit: UserNameEdit |
119 }; | 122 }; |
120 }); | 123 }); |
121 | 124 |
OLD | NEW |