3
// GNOME Do is the legal property of its developers, whose names are too
4
// numerous to list here. Please refer to the COPYRIGHT file distributed with
5
// this source distribution.
7
// This program is free software: you can redistribute it and/or modify it under
8
// the terms of the GNU General Public License as published by the Free Software
9
// Foundation, either version 3 of the License, or (at your option) any later
12
// This program is distributed in the hope that it will be useful, but WITHOUT
13
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17
// You should have received a copy of the GNU General Public License along with
18
// this program. If not, see <http://www.gnu.org/licenses/>.
22
using System.Text.RegularExpressions;
30
public class Configuration : AbstractLoginWidget
32
const string EmailPattern = @"[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\."
33
+ @"[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*"
34
+ @"[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?";
35
const string Uri = "https://www.google.com/accounts/NewAccount?service=cl";
36
public Configuration()
38
GetAccountButton.Uri = Uri;
41
protected override bool Validate (string username, string password)
43
if (ValidateUsername (username) && password.Length > 0)
44
return GCal2.Connect (username, password);
49
private bool ValidateUsername (string username)
51
return new Regex (EmailPattern, RegexOptions.Compiled).IsMatch (username);