public static void RegisterUser(string email, string userName, string password, bool setAsCurrentUser = false) { var user = UserService.RegisterUser(email, userName, password); if (setAsCurrentUser) CurrentUser = user; }
public override User Update(User obj) { using (var conn = _sqlLite.GetConnection()) { var u = conn.Find<User>(obj.UserID); u.UpdateModel(obj); conn.Update(u); return u; } }
public override User Insert(User obj) { obj.DateCreated = DateTime.UtcNow; obj.UserID = Guid.NewGuid().ToString(); using (var conn = _sqlLite.GetConnection()) { conn.Insert(obj); } return obj; }
public User RegisterUser(string email, string userName, string password) { email = email.Trim(); userName = userName.Trim(); if (_ur.CheckEmail(email)) throw new EmailAlreadyInUseException(); if (_ur.CheckUsername(userName)) throw new UserNameAlreadyInUseException(); var user = new User(); user.UserName = userName; user.Email = email; user.Password = Crypto.Hash(password); return _ur.Insert(user); }
public static void Logout() { CurrentUser = null; }
public static void Login(string email, string password, bool rememberMe = false) { CurrentUser = UserService.Login(email, null, password, rememberMe); }
public void UpdateModel(User u) { UserName = u.UserName; Password = u.Password; }