mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
29 lines
708 B
C#
29 lines
708 B
C#
using OpenAuth.Domain.Interface;
|
|
using System;
|
|
using Infrastructure.Helper;
|
|
using OpenAuth.Domain;
|
|
|
|
namespace OpenAuth.App
|
|
{
|
|
public class LoginApp
|
|
{
|
|
private IUserRepository _repository;
|
|
|
|
public LoginApp(IUserRepository repository)
|
|
{
|
|
_repository = repository;
|
|
}
|
|
|
|
public void Login(string userName, string password)
|
|
{
|
|
var user = _repository.FindSingle(u => u.Account == userName);
|
|
if (user == null)
|
|
{
|
|
throw new Exception("Óû§ÕʺŲ»´æÔÚ");
|
|
}
|
|
|
|
user.CheckPassword(password);
|
|
SessionHelper.AddSessionUser(user);
|
|
}
|
|
}
|
|
} |