Пример #1
0
		public async Task<BaseResponse<UserLoginDto>> GetLoginInformation(LoginRequest request) {
			var result = await _userQueryService.GetByLogin(request.Username, request.Password);

			var response = new BaseResponse<UserLoginDto>(request.Identifier);
			response.Data = result;

			return response;
		}
Пример #2
0
		public async Task<ActionResult> SignIn(LoginModel model, string returnUrl) {

			if (ModelState.IsValid) {
				var request = new LoginRequest();
				request.Password = model.Password;
				request.Username = model.Email;

				var response = await _userProxy.GetLoginInformation(request);

				if (response.Ack == AckType.SUCCESS) {
					var data = response.Data;
					var identity = new AppIdentity(data.UserId.ToString(), data.Name, data.Email);

					_authenticationService.SignIn(identity, true);

					return RedirectToLocal(returnUrl);
				}
			}

			ModelState.AddModelError("", "Username or password incorret.");

			return View(model);
		}
Пример #3
0
		public async Task<BaseResponse<UserLoginDto>> GetLoginInformation(LoginRequest request) {
			return await Fetch<LoginRequest, BaseResponse<UserLoginDto>>(request, "user/logininformation/");
		}