ChrisCompleteCodeTrunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
using ActionTireCo.Crm.Model.Database;
using ActionTireCo.Crm.Model.Session;
using System;
using System.Collections.Generic;
using System.DirectoryServices.Protocols;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
namespace ActionTireCo.Crm.Controllers
{
public class AuthController : Controller
{
[HttpPost]
public ActionResult Verify(UserObject userObject)
{
try
{
ActionTireCoCrmContext context = new ActionTireCoCrmContext();
User user = (from u in context.User where u.Adname.ToUpper() == userObject.UserName.ToUpper() select u).SingleOrDefault<User>();
LdapConnection lcon = new LdapConnection(new LdapDirectoryIdentifier("ACTIONDC1", false, false));
NetworkCredential nc = new NetworkCredential(userObject.UserName, userObject.Password, "ATC");
lcon.Credential = nc;
lcon.AuthType = AuthType.Negotiate;
lcon.Bind(nc);
userObject.Validated = true;
Session["UserObject"] = userObject;
Session["User"] = user;
return RedirectToAction("Index", "Home");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
userObject.Validated = false;
Session["UserObject"] = userObject;
return RedirectToAction("Index", "Home");
}
}
}
}
|
Revision |
Author |
Commited |
Message |
1
|
BBDSCHRIS
|
Wed 22 Aug, 2018 20:08:03 +0000 |
|