using System; using System.Collections.Generic; using System.Linq; using System.Security.Principal; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using RustTools.muqing; using RustTools.Views; using static IniHelper; namespace RustTools.ApiFox; #pragma warning disable CS8981 // 该类型名称仅包含小写 ascii 字符。此类名称可能会成为该语言的保留值。 #pragma warning disable IDE1006 // 命名样式 public class user { /// /// 登陆 /// /// /// /// public static async Task loginPc(string account, string passWord) { var pattern = @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"; var v = Regex.IsMatch(account, pattern); //gj.sc(account + " " + v); //这里不知道为什么会出现 True 而不是 true 导致识别邮箱失败 var task = await wl.postAsync("/php/user.php?action=loginPc", new string[][] { new[]{ "account",account}, new[]{ "passWord", passWord }, new[]{ "isEmail", v.ToString().ToLower() } }); return task; } /// /// 获取信息 /// /// /// public static async Task SpaceInfo(string account) { var task = await wl.postAsync("/php/user.php?action=getSpaceInfo", new string[][] { new[]{ "account",account} }); return task; } /// /// 注册 /// /// /// /// /// /// public static async Task register(string account,string userName,string passWord,string email) { var task = await wl.postAsync("/php/user.php?action=register", new string[][] { new []{ "account",account}, new []{ "userName", userName }, new []{ "passWord", passWord }, new []{ "email", email }, new []{ "appID",gj.GetUUID()} }); return task; } /// /// 激活用户 /// /// /// /// public static async Task enableAccount(string account, string key) { var task = await wl.postAsync("/php/user.php?action=enableAccount", new string[][] { new []{ "account",account}, new []{ "key", key } }); return task; } /// /// 修改密码 发送邮箱验证码 /// /// /// public static async Task requestChangePassword(string account) { var pattern = @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"; var v = Regex.IsMatch(account, pattern); var task = await wl.postAsync("/php/user.php?action=requestChangePassword", new string[][] { new []{ "account",account}, new []{ "isEmail", v.ToString().ToLower()} }); return task; } /// /// 修改密码 /// /// /// /// /// public static async Task changePassword(string account, string newPassword, string code) { var pattern = @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"; var v = Regex.IsMatch(account, pattern); var task = await wl.postAsync("/php/user.php?action=changePassword", new string[][] { new []{ "account",account}, new []{ "isEmail", v.ToString().ToLower()}, new []{ "code", code}, new []{ "newPassword", newPassword} }); return task; } }