コード例 #1
0
ファイル: login.aspx.cs プロジェクト: sunilgautam/iChat
    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.");
        }
    }
コード例 #2
0
ファイル: login.aspx.cs プロジェクト: sunilgautam/iChat
 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.");
     }
 }
コード例 #3
0
ファイル: login.aspx.cs プロジェクト: sunilgautam/iChat
    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.");
        }
    }
コード例 #4
0
    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.");
        }
    }
コード例 #5
0
ファイル: register.aspx.cs プロジェクト: Neerajgithub/iChat
    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.");
        }
    }
コード例 #6
0
    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);
    }
コード例 #7
0
ファイル: userlogout.aspx.cs プロジェクト: Neerajgithub/iChat
        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);
    }
}
コード例 #8
0
ファイル: login.aspx.cs プロジェクト: sunilgautam/iChat
 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.");
     }
 }
コード例 #9
0
        public void Autenticacion_de_usuario_correcta()
        {
            var login = new LoginCls();

            NUnit.Framework.Assert.AreEqual("Autenticacion de usuario correcta.", login.autenticacionDeUsuarios("uswe", "Pass1258/*"));
        }