<commit_before>﻿using System.Web.Mvc;
using System.Web.Security;
using System.Web.Services.Description;
using Purchasing.Core.Domain;
using UCDArch.Web.Authentication;

namespace Purchasing.Web.Controllers
{
    /// <summary>
    /// Controller for the Account class
    /// </summary>
    public class AccountController : Controller
    {
        public string Message
        {
            set { TempData["Message"] = value; }
        }
        public ActionResult LogOn(string returnUrl)
        {
            string resultUrl = CASHelper.Login(); //Do the CAS Login

            if (resultUrl != null)
            {
                /*
                    this has been causing the "server cannot set status after HTTP headers have been sent elmah errors
                    suggested fix from : http://stackoverflow.com/questions/2383169/server-cannot-set-status-after-http-headers-have-been-sent-iis7-5
                */
                 //return Redirect(resultUrl);
                Response.Redirect(resultUrl, true);
            }

            TempData["URL"] = returnUrl;

            return View();
        }

        public ActionResult LogOut()
        {
            FormsAuthentication.SignOut();
            return Redirect("https://cas.ucdavis.edu/cas/logout");
        }

        /// <summary>
        /// Emulate a specific user, for Emulation Users only
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [Authorize(Roles = Role.Codes.EmulationUser)]
        public RedirectToRouteResult Emulate(string id /* Login ID*/)
        {<commit_msg>undid some testing stuff that didn't actually do anything to resolve the elmah errors<commit_after>﻿using System.Web.Mvc;
using System.Web.Security;
using System.Web.Services.Description;
using Purchasing.Core.Domain;
using UCDArch.Web.Authentication;

namespace Purchasing.Web.Controllers
{
    /// <summary>
    /// Controller for the Account class
    /// </summary>
    public class AccountController : Controller
    {
        public string Message
        {
            set { TempData["Message"] = value; }
        }
        public ActionResult LogOn(string returnUrl)
        {
            string resultUrl = CASHelper.Login(); //Do the CAS Login

            if (resultUrl != null)
            {
                 return Redirect(resultUrl);
            }

            TempData["URL"] = returnUrl;

            return View();
        }

        public ActionResult LogOut()
        {
            FormsAuthentication.SignOut();
            return Redirect("https://cas.ucdavis.edu/cas/logout");
        }

        /// <summary>
        /// Emulate a specific user, for Emulation Users only
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [Authorize(Roles = Role.Codes.EmulationUser)]
        public RedirectToRouteResult Emulate(string id /* Login ID*/)
        {
{'fraction_non_alphanumeric': 0.11046709853392431, 'fraction_numerical': 0.003068530514831231, 'mean_word_length': 1.8211538461538461, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 2, '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': '406495', 'n_tokens_mistral': 775, 'n_tokens_neox': 752, 'n_words': 189}