Beispiel #1
0
 protected void btnSend_Click(object sender, EventArgs e)
 {
     RadCaptcha1.Validate();
     if (Page.IsValid)
     {
     }
 }
Beispiel #2
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     RadCaptcha1.Validate();
     if (Page.IsValid)
     {
         SysUser user = db.SysUsers.SingleOrDefault <SysUser>(u => u.UserAccount.AccountName == AccountUtilities.ProcessUsername(txtUsername.Text) &&
                                                              u.UserAccount.Password == Hash.GetHashMD5Value(txtPassword.Text));
         if (user != null)
         {
             UserAccount userAcc = user.UserAccount;
             if (userAcc.IsActivated == false) //tai khoan chua kich hoat
             {
                 lblMessage.Text = Resources.AccountMessage.AccountNotActivated;
             }
             else if (userAcc.IsDisabled == true) //tai khoan dang tam khoa
             {
                 lblMessage.Text = String.Format(Resources.AccountMessage.AccountBlock, userAcc.DisabledReason);
             }
             else if (userAcc.IsExpired == true) //tai khoan het han (chua xoa hoan toan khoi he thong)
             {
                 lblMessage.Text = Resources.AccountMessage.AccountExpired;
             }
             else if ((userAcc.SysGroupId != (int)KHCNCT.Globals.Enums.Role.UserRole.Administrator) &&
                      (userAcc.SysGroupId != (int)KHCNCT.Globals.Enums.Role.UserRole.InternalUser))         //nguoi dung ko co quyen dang nhap
             {
                 lblMessage.Text = Resources.AccountMessage.AccessDenied;
             }
             else
             {
                 RegisterLoginSession(user);
                 if (Request.QueryString["returnurl"] != null)
                 {
                     Response.Redirect(HttpUtility.UrlDecode(Request.QueryString["returnurl"]));
                 }
                 else
                 {
                     Response.Redirect(Request.Url.ToString());
                 }
                 //else Response.Redirect(Common.GenerateUrl("profile"));
             }
         }
         else
         {
             lblMessage.Text = Resources.AccountMessage.LoginFailed;
         }
     }
 }