<commit_before>﻿using System;
using System.Linq;
using System.Web.Mvc;
using RentThatBike.Web.Models;
using RentThatBike.Web.ServiceModel.Types;
using ServiceStack;
using ServiceStack.CacheAccess;
using ServiceStack.Common;
using ServiceStack.Common.Web;
using ServiceStack.Mvc;
using ServiceStack.ServiceInterface;
using ServiceStack.ServiceInterface.Auth;
using ServiceStack.WebHost.Endpoints;

namespace RentThatBike.Web.Controllers
{
    public class LoginController : ServiceStackController<AuthUserSession>
    {
        public AuthService AuthService { get; set; }
        //
        // GET: /login/
        [HttpGet]
        public ActionResult Index(string redirect)
        {
            return View(new LoginData{Redirect = redirect});
        }

        [HttpPost]
        public ActionResult LogIn(LoginData loginData)
        {
            if (!ModelState.IsValid)
            {
                return View("Index", loginData);
            }

            AuthService.RequestContext = System.Web.HttpContext.Current.ToRequestContext();
            try
            {<commit_msg>Chapter4 Example5: simplified LoginController declaration<commit_after>﻿using System;
using System.Linq;
using System.Web.Mvc;
using RentThatBike.Web.Models;
using RentThatBike.Web.ServiceModel.Types;
using ServiceStack;
using ServiceStack.CacheAccess;
using ServiceStack.Common;
using ServiceStack.Common.Web;
using ServiceStack.Mvc;
using ServiceStack.ServiceInterface;
using ServiceStack.ServiceInterface.Auth;
using ServiceStack.WebHost.Endpoints;

namespace RentThatBike.Web.Controllers
{
    public class LoginController : Controller
    {
        public AuthService AuthService { get; set; }
        //
        // GET: /login/
        [HttpGet]
        public ActionResult Index(string redirect)
        {
            return View(new LoginData{Redirect = redirect});
        }

        [HttpPost]
        public ActionResult LogIn(LoginData loginData)
        {
            if (!ModelState.IsValid)
            {
                return View("Index", loginData);
            }

            AuthService.RequestContext = System.Web.HttpContext.Current.ToRequestContext();
            try
            {
{'fraction_non_alphanumeric': 0.08337129840546698, 'fraction_numerical': 0.0009111617312072893, 'mean_word_length': 2.653910149750416, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1455973', 'n_tokens_mistral': 580, 'n_tokens_neox': 573, 'n_words': 126}