Chromium Code Reviews| Index: remoting/host/setup/pin_validator.cc |
| diff --git a/remoting/host/setup/pin_validator.cc b/remoting/host/setup/pin_validator.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0c9feabdd1ccaaeb575e6abd45c94645bfe0bab0 |
| --- /dev/null |
| +++ b/remoting/host/setup/pin_validator.cc |
| @@ -0,0 +1,22 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "remoting/host/setup/pin_validator.h" |
| + |
| +namespace remoting { |
| + |
| +bool IsPinValid(const std::string& pin) { |
| + if (pin.length() < 6) { |
| + return false; |
| + } |
| + for (size_t i = 0; i < pin.length(); i++) { |
| + char c = pin[i]; |
| + if (c < '0' || c > '9') { |
|
alexeypa (please no reviews)
2012/10/11 16:57:52
This code is not i18n-friendly. Should we treat |p
simonmorris
2012/10/11 21:27:35
I don't want users to enter anything but plain old
|
| + return false; |
| + } |
| + } |
| + return true; |
| +} |
| + |
| +} // namespace remoting |