Exemple #1
0
        private void button_login_Click(object sender, RoutedEventArgs e)
        {
            AccountLoginDTO accountLoginDTO = new AccountLoginDTO(); //实例化AccountLoginDTO
            {                                                        //将控件中的账号密码传入云平台
                accountLoginDTO.Account      = username.Text;
                accountLoginDTO.Password     = password.Password;
                accountLoginDTO.IsRememberMe = (click_remeberme.IsChecked == true);
            }
            // ResultMsg<AccountLoginResultDTO> resultMsg = SDK.UserLogin(accountLoginDTO);
            bool isLogin = ForLogin.UserLogin(accountLoginDTO);

            if (click_remeberme.IsChecked == true)
            {
                password.Password = accountLoginDTO.Password;
            }
            if (isLogin)
            {
                //schoolname = resultMsg.ResultObj.CollegeName;
                //accesstoken = resultMsg.ResultObj.AccessToken;
                MessageBox.Show("登录成功!,您位于" + ForLogin.UserInfo(accountLoginDTO) + "\n即将进入排队系统!", "登录成功");
                new MainWindow().Show();
                this.Close();
            }

            else
            {
                MessageBox.Show("登录失败!,请重试", "登录失败");
            }
        }
        public static JsonWebToken GenerateForLogin(this IJsonWebTokenService self, int userId)
        {
            Guard.NotNull(self, nameof(self));
            Guard.NotZeroOrNegative(userId, nameof(userId));

            var payload = new ForLogin
            {
                UserId = userId
            };

            return self.Generate(payload, TimeSpan.FromMinutes(Config.Security.LoginIsValidForMinutes), Config.Security.AuthenticationKeyPhrase);
        }
Exemple #3
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            AccountLoginDTO dto = new AccountLoginDTO();

            dto.Account  = "123";  // txtName.Text.Trim();
            dto.Password = "******"; // pasPwd.Password;

            bool isLogin = ForLogin.UserLogin(dto);

            if (isLogin)
            {
                new MainWindow().Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("登录失败", "提示");
            }
        }
Exemple #4
0
        public ActionResult Login(ForLogin user)
        {
            if (!ModelState.IsValid)
            {
                return(View(user));
            }
            var userDb = db.Users.FirstOrDefault(m => m.Email.Trim() == user.Email.Trim());

            if (userDb == null)
            {
                ModelState.AddModelError("Email", "Email is not valid");
                return(View(user));
            }
            if (!Crypto.VerifyHashedPassword(userDb.Password, user.Password))
            {
                ModelState.AddModelError("AllError", "Email or Password is not valid!");
                return(View(user));
            }

            Session["user"] = userDb;
            User currentuser = Session["user"] as User;

            return(RedirectToAction("Index", "Home"));
        }