Beispiel #1
0
		public ActionResult SignIn(string returnUrl) {

			if (string.IsNullOrEmpty(returnUrl)) {
				returnUrl = "/";
			}

			var model = new LoginModel();
			model.ReturnUrl = returnUrl;

			return View(model);
		}
Beispiel #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);
		}