public string GetToken() { if (Authenticated) { return(SecureToken.CreateToken(this.UserID)); } return(""); }
public bool Authenticate(string token) { SecureToken sToken = new SecureToken(token); if (sToken.Valid) { Authenticated = KeyLoad(sToken.UserId); if (Authenticated) { return(true); } } return(false); }
public bool New(string userid, string password) { if (this.Load(userid)) { return(false); } if (this.InitNew()) { this.UserID = userid; this.Password = SecureToken.Encrypt(password); return(true); } return(false); }
protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["login"]; if (cookie != null) { User u = new User(); if (u.Authenticate(cookie.Value)) { CurrentUser = u; Response.SetCookie(new HttpCookie("login", SecureToken.CreateToken(u.UserID)) { Expires = new DateTime(2100, 1, 1) }); } } PreInitPage(); }
public bool LogIn(string password) { Authenticated = SecureToken.Encrypt(password) == Password; return(Authenticated); }