<commit_before>﻿using BlogEngine.Domain.Models;
using BlogEngine.Repository.Models;
using Microsoft.AspNet.Identity;
using Microsoft.Owin.Security;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using UserManagementService.Interfaces;
using WebApp.Models;

namespace WebApp.Controllers
{
    [Authorize]
    public class AccountController : Controller
    {
        private readonly IUserService<BlogUser, BlogUserEntity, int> _userService;

        public AccountController(IUserService<BlogUser, BlogUserEntity, int> userService)
        {
            _userService = userService;

            //TODO remove this after first run
            //this is here just to show how to boost strap your first user when the project is first setup.
           // _userService.Create(new BlogUser {Email = "<EMAIL>", DisplayName = "<NAME>", UserName = "Jon"}, "abc123def!");
        }

        


        [AllowAnonymous]
        public ActionResult Login(string returnUrl)
        {
            ViewBag.isLogin = true;

            RegisterReturnUrl(returnUrl);

            return this.View();
        }

        private void RegisterReturnUrl(string returnUrl)
        {
            //So that the user can be referred back to where they were when they click logon
            if (string.IsNullOrEmpty(returnUrl) && Request.UrlReferrer != null)
                returnUrl = Server.UrlEncode(Request.UrlReferrer.PathAndQuery);

            if (Url.IsLocalUrl(returnUrl) && !string.IsNullOrEmpty(returnUrl))
            {
                ViewBag.ReturnURL = returnUrl;
            }
        }<commit_msg>changed comment<commit_after>﻿using BlogEngine.Domain.Models;
using BlogEngine.Repository.Models;
using Microsoft.AspNet.Identity;
using Microsoft.Owin.Security;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using UserManagementService.Interfaces;
using WebApp.Models;

namespace WebApp.Controllers
{
    [Authorize]
    public class AccountController : Controller
    {
        private readonly IUserService<BlogUser, BlogUserEntity, int> _userService;

        public AccountController(IUserService<BlogUser, BlogUserEntity, int> userService)
        {
            _userService = userService;

            //TODO remove this after first run
            //this is here just to show how to boost strap your first user when the project is first setup.
            //_userService.Create(new BlogUser {Email = "MYEMAILHERE", DisplayName = "MY DISPLAY NAME HERE", UserName = "MYUSERNAMEHERE"}, "MYPASSWORDHERE");
        }

        


        [AllowAnonymous]
        public ActionResult Login(string returnUrl)
        {
            ViewBag.isLogin = true;

            RegisterReturnUrl(returnUrl);

            return this.View();
        }

        private void RegisterReturnUrl(string returnUrl)
        {
            //So that the user can be referred back to where they were when they click logon
            if (string.IsNullOrEmpty(returnUrl) && Request.UrlReferrer != null)
                returnUrl = Server.UrlEncode(Request.UrlReferrer.PathAndQuery);

            if (Url.IsLocalUrl(returnUrl) && !string.IsNullOrEmpty(returnUrl))
            {
                ViewBag.ReturnURL = returnUrl;
            }
        }
{'fraction_non_alphanumeric': 0.08182653999387067, 'fraction_numerical': 0.0009193993257738277, 'mean_word_length': 2.4983922829581995, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3303246', 'n_tokens_mistral': 865, 'n_tokens_neox': 844, 'n_words': 230}