protected void btnSubmit_Click(object sender, EventArgs e) { if (CheckFields()) { LoginCls LogObj = new LoginCls(txtUserName.Text, txtPwd.Text); switch (LogObj.CheckLogin("admin")) { case users.Anonymous: ShowMessage(Message.Error, "Invalid Username Or Password."); break; case users.Admin: Session.Add("_di09ADM", LogObj.AInfo); Response.Redirect(GetPath(LogObj.ProfilePage), true); break; default: break; } } else { ShowMessage(Message.Error, "Fill all required fields."); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (CheckFields()) { LoginCls LogObj = new LoginCls(txtUserName.Text, txtPwd.Text); switch (LogObj.CheckLogin("user")) { case users.Anonymous: ShowMessage(Message.Error, "Invalid Username Or Password."); break; case users.User: Session.Add("_di09USR", LogObj.UInfo); Response.Redirect(GetPath(LogObj.ProfilePage), true); //if (hiddenSource.Value != "" && File.Exists(Server.MapPath(hiddenSource.Value))) //{ // Response.Redirect(hiddenSource.Value, true); //} //else //{ // Response.Redirect(LogObj.ProfilePage, true); //} break; default: break; } } else { ShowMessage(Message.Error, "Fill all required fields."); } }
public void RegisterUser() { if (CheckPage()) { User UserObj = new User(); UserObj.Email = txtEmail.Text; UserObj.Password = txtPwd.Text; UserObj.Image = USER_INIT_PATH; if (!UserObj.CheckUser()) { if (UserObj.RegUser()) { //userInfo uInfo = new userInfo(); //uInfo.UserId = UserObj.UserId; //uInfo.UserName = getUserName(UserObj.Email); //Session.Add("_di09USR", uInfo); //Response.Redirect("~/home.aspx", true); LoginCls LogObj = new LoginCls(UserObj.Email, UserObj.GetPassword); switch (LogObj.CheckLogin("user")) { case users.Anonymous: ShowMessage(Message.Error, "Invalid Username Or Password."); break; case users.User: Session.Add("_di09USR", LogObj.UInfo); Response.Redirect(LogObj.ProfilePage, true); break; default: break; } } else { ShowMessage(Message.Error, "Unable To Register."); } } else { ShowMessage(Message.Warning, "Email Already Exists."); } } else { ShowMessage(Message.Error, "Fill all fields."); } }
protected override void OnPreInit(EventArgs e) { if (Context.Session != null) { if (Session["_di09USR"] != null) { userInfo uInfo = (userInfo)Session["_di09USR"]; //EXIT USER FROM ANY PRE CHATROOMS PublicChat pObj = new PublicChat(); pObj.User_id = uInfo.UserId; pObj.LeaveChatRoom(); LoginCls logoutObj = new LoginCls(); logoutObj.LogOut(uInfo.UserId); } } Session.Abandon(); Response.Redirect("~/home.aspx", true); }
if (Context.Session != null) { if (Session["_di09USR"] != null) { userInfo uInfo = (userInfo)Session["_di09USR"]; //EXIT USER FROM ANY PRE CHATROOMS PublicChat pObj = new PublicChat(); pObj.User_id = uInfo.UserId; pObj.LeaveChatRoom(); LoginCls logoutObj = new LoginCls(); logoutObj.LogOut(uInfo.UserId); } } Session.Abandon(); Response.Redirect("~/home.aspx", true); } }
public void Autenticacion_de_usuario_correcta() { var login = new LoginCls(); NUnit.Framework.Assert.AreEqual("Autenticacion de usuario correcta.", login.autenticacionDeUsuarios("uswe", "Pass1258/*")); }