public async Task <IActionResult> Teacher_LoginByPassword(LoginByPasswordViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                throw new ValidatorException();
            }
            var teacher = await _Context.Teachers.AsNoTracking().Where(vn => vn.Mobile == viewModel.Mobile).FirstOrDefaultAsync();

            if (teacher == null)
            {
                throw new ValidatorException("不存在该用户");
            }
            if (teacher.Password != MD5Builder.Builder32Hash(viewModel.Password))
            {
                throw new ValidatorException("登陆密码不正确");
            }
            return(Json(teacher));
        }
Exemple #2
0
 public LoginByPassword()
 {
     InitializeComponent();
     BindingContext = viewModel = new LoginByPasswordViewModel(EbLayout.GetMessageLoader());
     viewModel.Bind2FAToggleEvent(ShowTwoFAWindow);
 }