public async Task <ActionResult> Login(InputLogin model) { if (!ModelState.IsValid) { return(View(model)); } //var result = loginOnManager.LoginOn(model); using (SubBugEntities db = new SubBugEntities()) { var Pwd = md5.MD5Encrypt(model.LoginPwd); var result = await db.TB_LoginOn.FirstOrDefaultAsync(l => l.LoginNo == model.LoginNo && l.LoginPwd == Pwd); if (result != null) { Session["LoginName"] = result; if (((TB_LoginOn)Session["LoginName"]).AId != 1) { return(RedirectToAction("Index", "Follow")); } return(RedirectToAction("List", "Home")); } ViewData["info"] = "失败!"; return(View(model)); } }
public async Task <IActionResult> Login( [FromBody] InputLogin login ) { if (!ModelState.IsValid) { return(new BadRequestObjectResult(ModelState)); } var user = await AuthenticateUser(login !); if (user == null) { return(Unauthorized()); } var accessLevel = await FindUserAccessLevel(user); var token = GenerateToken(user.Cpf !, accessLevel); return(Ok(new TokenResponse { Token = token })); }
private void ButtonClear_OnClick(object sender, RoutedEventArgs e) { InputLogin.Clear(); InputPassword.Clear(); LabelShow.Text = string.Empty; }
public async Task <OutputLogin> Login([FromBody] InputLogin input) { var cc = await new HttpClient().PostAsync("http://api.51pinzhi.cn/order/api/Query/QueryPrePayIP8", new StringContent("{}", System.Text.Encoding.UTF8, "application/json")); return(new OutputLogin { Data = await cc.Content.ReadAsStringAsync() }); }
public async Task <OutputLogin> Login([FromBody] InputLogin input) { var client = _httpClientFactory.CreateClient(); await client.GetStringAsync("http://www.baidu.com"); return(new OutputLogin { }); }
private void ButtonClear_OnClick(object sender, RoutedEventArgs e) { InputLogin.Clear(); InputPassword.Clear(); ButtonAuthorization.IsEnabled = false; LabelShow.Text = string.Empty; }
private void ButtonClear_Click(object sender, RoutedEventArgs e) { InputLogin.Clear(); InputPassword.Clear(); InputRepeatPassword.Clear(); LabelPasswordCheckAlphabet.Text = ""; LabelPasswordCheckSymbols.Text = ""; LabelPasswordCheckLength.Text = ""; }
public OutputLogin Login([FromBody] InputLogin input) { var result = _serviceClient.PostWebApi <string>("http://api.51pinzhi.cn/order/api/Query/QueryPrePayIP8", new { StartTime = "2017-05-09 14:35:14", EndTime = "2018-05-09 14:35:14" }, isTrace: true); var result2 = _serviceClient.PostWebApi <string>("http://api.51pinzhi.cn/order/api/Query/QueryPayedOrderCount", new { OrderType = 0, OrderChannel = 0 }, isTrace: true); return(new OutputLogin { Data = result + result2 }); }
public OutputLogin Login([FromBody] InputLogin input) { var result = _serviceClient.GetWebApi <string>("Pinzhi.Config.Service", "/configs/PinzhiGO/Platform?version=0&sign=d029ccffbe3bf77020fd5da3db3d737cdfd42ae5146ed2df9df29c88f3365b0c", isTrace: true); return(new OutputLogin { Data = result }); }
public async Task <OutputLogin> Login([FromBody] InputLogin input) { Request.EnableRewind(); Request.Body.Position = 0; using (var reader = new StreamReader(Request.Body)) { var body = reader.ReadToEnd(); Request.Body.Seek(0, SeekOrigin.Begin); body = reader.ReadToEnd(); } return(new OutputLogin { }); }
private async Task <User?> AuthenticateUser(InputLogin login) { var user = await FindUserWithLogin(login.Login); var hash = _passwordHash.Of(login.Password); if (user != null) { if (user.Password != hash) { user = null; } } return(user); }
private void ButtonRegister_Click(object sender, RoutedEventArgs e) { string login = InputLogin.Text; string password = InputPassword.Password; if (login.Length < 5 || password.Length < 5) { MessageBox.Show("Некоректная длина", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Warning); return; } DBConnection db = new DBConnection(); db.AddAccount(login, password); MessageBox.Show("Аккаунт был успешно добавлен", "Успех!", MessageBoxButton.OK, MessageBoxImage.Information); InputLogin.Clear(); InputPassword.Clear(); }
private async void InputLogin_TextChanged(object sender, TextChangedEventArgs e) { if (await InputLogin.GetIdle()) { DBconnection dBconnection = new DBconnection(); dBconnection.ConnectDB(); string query = $"SELECT * FROM Account WHERE login = '******';"; var result = dBconnection.SelectQuery(query); if (result.Read()) { LabelLoginCheck.Foreground = Brushes.Red; LabelLoginCheck.Text = "Логин занят"; } else { LabelLoginCheck.Foreground = Brushes.Green; LabelLoginCheck.Text = "Логин свободен"; } } }
public ActionResult Index(InputLogin input) { if (ModelState.IsValid) { Users entity = null; if ("*****@*****.**" != input.Email) // if ("*****@*****.**" != input.Email) { ViewBag.Message = "Invalid Admin Email"; ViewBag.Type = "alert-danger"; Session.RemoveAll(); return(View(input)); } string _password = AesCryptography.Encrypt(input.Password); GenericRepository <Users> _userRepo = new GenericRepository <Users>(_unitOfWork); entity = _userRepo.Repository.Get(p => p.Email == input.Email && p.Password == _password); if (entity != null) { Session["AdminID"] = entity.UserID; Session["FullName"] = entity.UserName; Session["ThumbnailURL"] = entity.ThumbnailURL; Session["ImageURL"] = entity.ImageURL; return(RedirectToAction("Index", "Users")); } else { ViewBag.Message = "Invalid email or password"; ViewBag.Type = "alert-danger"; } } Session.RemoveAll(); return(View(input)); }
private void ButtonClear_Click(object sender, RoutedEventArgs e) { InputLogin.Clear(); InputPassword.Clear(); LabelCheck.Text = ""; }
public async Task <OutputLogin> Login([FromBody] InputLogin input) { return(new OutputLogin { }); }
public OutputLogin Login([FromBody] InputLogin input, [FromServices] HttpClient httpClient) { return(new OutputLogin { Data = httpClient.PostAsync("http://api.51pinzhi.cn/order/api/Query/QueryPrePayIP8", new StringContent("{}", System.Text.Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result }); }