| @ -0,0 +1,100 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <PropertyGroup> | |||||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||||
| <ProductVersion> | |||||
| </ProductVersion> | |||||
| <SchemaVersion>2.0</SchemaVersion> | |||||
| <ProjectGuid>{269C33B6-9ACC-4E3F-9BD2-B2AAB620E5DE}</ProjectGuid> | |||||
| <OutputType>Library</OutputType> | |||||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||||
| <RootNamespace>BWP.B3DogAuth</RootNamespace> | |||||
| <AssemblyName>B3DogAuth</AssemblyName> | |||||
| <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |||||
| <FileAlignment>512</FileAlignment> | |||||
| <KeyContainerName>TSingSoft</KeyContainerName> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||||
| <DebugSymbols>true</DebugSymbols> | |||||
| <DebugType>full</DebugType> | |||||
| <Optimize>false</Optimize> | |||||
| <OutputPath>bin\Debug\</OutputPath> | |||||
| <DefineConstants>TRACE;DEBUG;CODE_ANALYSIS</DefineConstants> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <WarningLevel>4</WarningLevel> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||||
| <DebugType>pdbonly</DebugType> | |||||
| <Optimize>true</Optimize> | |||||
| <OutputPath>bin\Release\</OutputPath> | |||||
| <DefineConstants>TRACE</DefineConstants> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <WarningLevel>4</WarningLevel> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | |||||
| <Reference Include="B3Frameworks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>..\..\..\tsref\Debug\B3Frameworks.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="Forks.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||||
| <Private>False</Private> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="Forks.Utils, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||||
| <Private>False</Private> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="MainSystem, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> | |||||
| <Private>False</Private> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="System"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="System.Core"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="System.Data"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="System.Web.Extensions"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="TSingSoft.WebControls2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>..\..\..\tsref\Debug\TSingSoft.WebControls2.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="Wpf, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> | |||||
| <Private>False</Private> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="Wpf.System, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> | |||||
| <Private>False</Private> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="Wpf.System.Web, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> | |||||
| <Private>False</Private> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <Compile Include="..\..\..\version\tslib_version.cs"> | |||||
| <Link>tslib_version.cs</Link> | |||||
| </Compile> | |||||
| <Compile Include="DogAuthConfig.cs" /> | |||||
| <Compile Include="DogAuthPlugin.cs" /> | |||||
| <Compile Include="DogLoginUser.cs" /> | |||||
| <Compile Include="IDogLoginUserBL.cs" /> | |||||
| <Compile Include="MobileAuthCenter.cs" /> | |||||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||||
| </ItemGroup> | |||||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||||
| Other similar extension points exist, see Microsoft.Common.targets. | |||||
| <Target Name="BeforeBuild"> | |||||
| </Target> | |||||
| <Target Name="AfterBuild"> | |||||
| </Target> | |||||
| --> | |||||
| </Project> | |||||
| @ -0,0 +1,30 @@ | |||||
| using Forks.EnterpriseServices; | |||||
| using Forks.Utils.Configuration; | |||||
| using TSingSoft.WebPluginFramework; | |||||
| namespace BWP.B3DogAuth { | |||||
| [ConfigurationEnabled] | |||||
| public class DogAuthConfig { | |||||
| public DogAuthConfig() { | |||||
| ConfigurationUtil.Fill(this); | |||||
| } | |||||
| private BoolConfigRef _closeMobileVerifyCode = new BoolConfigRef(false); | |||||
| [LogicName("关闭手机验证码登陆")] | |||||
| public BoolConfigRef CloseMobileVerifyCode { | |||||
| get { return _closeMobileVerifyCode; } | |||||
| set { _closeMobileVerifyCode = value; } | |||||
| } | |||||
| private StringListConfigRef _canLoginWithMobileVerifyCode = new StringListConfigRef(); | |||||
| [LogicName("允许使用手机验证码登陆的用户")] | |||||
| [ConfigurationItemDescription("关闭手机验证码登陆时生效")] | |||||
| public StringListConfigRef CanLoginWithMobileVerifyCode { | |||||
| get { return _canLoginWithMobileVerifyCode; } | |||||
| set { _canLoginWithMobileVerifyCode = value; } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,74 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using Bwp.MainSystem.Auth; | |||||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||||
| using Forks.EnterpriseServices.DomainObjects2; | |||||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||||
| using Forks.EnterpriseServices.SqlDoms; | |||||
| using TSingSoft.WebPluginFramework; | |||||
| namespace BWP.B3DogAuth { | |||||
| public class DogAuthPlugin : IAuthPlugin { | |||||
| public void Auth(IDictionary<string, object> context) { | |||||
| if (UserAndPasswordOnly(context)) { | |||||
| return; | |||||
| } | |||||
| if (context.ContainsKey("SkipPasswordAuth")) { | |||||
| return; | |||||
| } | |||||
| var name = (string)context["Name"]; | |||||
| if (context.ContainsKey("VerifyCode")) { | |||||
| var verifyCode = (string)context["VerifyCode"]; | |||||
| if (!MobileAuthCenter.Auth(name, verifyCode)) { | |||||
| throw new Exception("验证码不正确"); | |||||
| } | |||||
| } | |||||
| else { | |||||
| int dogNo; | |||||
| if (int.TryParse(name, out dogNo)) { | |||||
| context["Name"] = DogNoToUserName(dogNo); | |||||
| context.Add("DogAuthNo", name); | |||||
| } | |||||
| else { | |||||
| if (AllowNoDog) { | |||||
| CheckNoDogUserName(name); | |||||
| } | |||||
| else { | |||||
| throw new WpfException("Internal error: 43bb83d0-3388-4cde-9459-4dc9a44918e4 " + name); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| static bool UserAndPasswordOnly(IDictionary<string, object> context) { | |||||
| return context.EGetDefault<bool>("UserAndPasswordOnly"); | |||||
| } | |||||
| static string DogNoToUserName(int dogNo) { | |||||
| IDogLoginUserBL bl = BIFactory.Create<IDogLoginUserBL>(); | |||||
| var dogLoginUser = bl.Load(dogNo); | |||||
| if (dogLoginUser == null) { | |||||
| throw new WpfException(string.Format("您当前的黑贝序号是{0},没有在黑贝认证中定义", dogNo)); | |||||
| } | |||||
| return dogLoginUser.User_Name; | |||||
| } | |||||
| static void CheckNoDogUserName(string userName) { | |||||
| var query = new DQueryDom(new JoinAlias(typeof(DogLoginUser))); | |||||
| query.Where.Conditions.Add(DQCondition.EQ("User_Name", userName)); | |||||
| query.Range = SelectRange.Top(1); | |||||
| query.Columns.Add(DQSelectColumn.Field("ID")); | |||||
| using (IDmoSession session = Dmo.NewSession()) { | |||||
| if (session.ExecuteScalar(query) != null) { | |||||
| throw new Exception(string.Format("用户名{0}必须使用黑贝登录", userName)); | |||||
| } | |||||
| } | |||||
| } | |||||
| public static bool AllowNoDog { | |||||
| get { return Wpf.Parameters.AsBool("B3DogAuth.AllowUnConfigedDog"); } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,42 @@ | |||||
| using System; | |||||
| using BWP.B3Frameworks.BO; | |||||
| using Forks.EnterpriseServices; | |||||
| using Forks.EnterpriseServices.DataForm; | |||||
| using Forks.EnterpriseServices.DomainObjects2; | |||||
| using TSingSoft.WebPluginFramework; | |||||
| namespace BWP.B3DogAuth { | |||||
| [LogicName("黑贝认证")] | |||||
| [Serializable] | |||||
| [DFClass] | |||||
| [KeyField("ID", KeyGenType.assigned)] | |||||
| [DFCPrompt("序号", Property = "ID")] | |||||
| public class DogLoginUser : Base { | |||||
| [LogicName("用户ID")] | |||||
| [DFNotEmpty] | |||||
| public long User_ID { | |||||
| get; | |||||
| set; | |||||
| } | |||||
| [ReferenceTo(typeof(WpfUser), "Name")] | |||||
| [Join("User_ID", "ID")] | |||||
| [LogicName("用户名")] | |||||
| public string User_Name { | |||||
| get; | |||||
| set; | |||||
| } | |||||
| [ReferenceTo(typeof(WpfUser), "Stopped")] | |||||
| [Join("User_ID", "ID")] | |||||
| [LogicName("停用")] | |||||
| public bool? Stopped { get; set; } | |||||
| [LogicName("备注")] | |||||
| public string Remark { | |||||
| get; | |||||
| set; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,32 @@ | |||||
| using System; | |||||
| using BWP.B3Frameworks.BL; | |||||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||||
| using Forks.EnterpriseServices.DomainObjects2; | |||||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||||
| namespace BWP.B3DogAuth { | |||||
| [BusinessInterface(typeof(DogLoginUserBL))] | |||||
| public interface IDogLoginUserBL : IBaseBL<DogLoginUser> { | |||||
| } | |||||
| public class DogLoginUserBL : BaseBL<DogLoginUser>, IDogLoginUserBL { | |||||
| protected override void beforeInsert(DogLoginUser dmo) { | |||||
| if (dmo.ID == 0) | |||||
| throw new Exception("黑贝序号不能为空"); | |||||
| if (dmo.User_ID == 0) | |||||
| throw new Exception("用户名不能为空"); | |||||
| DQueryDom query = new DQueryDom(new JoinAlias(typeof(DogLoginUser))); | |||||
| query.Where.Conditions.Add(DQCondition.Or(DQCondition.EQ("ID", dmo.ID), DQCondition.EQ("User_ID", dmo.User_ID))); | |||||
| query.Columns.Add(DQSelectColumn.Field("ID")); | |||||
| if (Session.ExecuteScalar(query) != null) { | |||||
| throw new Exception("黑贝序号或用户已定义"); | |||||
| } | |||||
| base.beforeInsert(dmo); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,47 @@ | |||||
| using System; | |||||
| using System.Collections.Concurrent; | |||||
| using System.Text; | |||||
| using TSingSoft.WebPluginFramework; | |||||
| namespace BWP.B3DogAuth { | |||||
| public class MobileAuthCenter { | |||||
| static ConcurrentDictionary<string, Tuple<string, DateTime>> mDic = new ConcurrentDictionary<string, Tuple<string, DateTime>>(); | |||||
| public static string GenVerifyCode(string username) { | |||||
| var code = GenRandomCode(); | |||||
| var tuple = GenRandomCode(); | |||||
| mDic.AddOrUpdate(username, tuple, (arg1, arg2) => tuple); | |||||
| return tuple.Item1; | |||||
| } | |||||
| public static bool Auth(string username, string verifyCode) { | |||||
| Tuple<string, DateTime> tuple; | |||||
| if (mDic.TryGetValue(username, out tuple)) { | |||||
| if (tuple.Item2 < BLContext.Now) { | |||||
| mDic.TryRemove(username, out tuple); | |||||
| return false; | |||||
| } | |||||
| else if (tuple.Item1 == verifyCode) { | |||||
| return true; | |||||
| } | |||||
| else { | |||||
| return false; | |||||
| } | |||||
| } | |||||
| else { | |||||
| return false; | |||||
| } | |||||
| } | |||||
| static Tuple<string, DateTime> GenRandomCode() { | |||||
| var rand = new Random(BLContext.Now.GetHashCode()); | |||||
| var builder = new StringBuilder(); | |||||
| for (int i = 0; i < 4; i++) { | |||||
| builder.Append(rand.Next(9)); | |||||
| } | |||||
| return new Tuple<string, DateTime>(builder.ToString(), BLContext.Now.AddMinutes(5)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,39 @@ | |||||
| using System.Reflection; | |||||
| using System.Runtime.CompilerServices; | |||||
| using System.Runtime.InteropServices; | |||||
| using Forks.EnterpriseServices.DomainObjects2; | |||||
| // General Information about an assembly is controlled through the following | |||||
| // set of attributes. Change these attribute values to modify the information | |||||
| // associated with an assembly. | |||||
| [assembly: AssemblyTitle("DogAutho.BO")] | |||||
| [assembly: AssemblyDescription("")] | |||||
| [assembly: AssemblyConfiguration("")] | |||||
| [assembly: AssemblyCompany("")] | |||||
| [assembly: AssemblyProduct("DogAutho.BO")] | |||||
| [assembly: AssemblyCopyright("Copyright © 2008")] | |||||
| [assembly: AssemblyTrademark("")] | |||||
| [assembly: AssemblyCulture("")] | |||||
| // Setting ComVisible to false makes the types in this assembly not visible | |||||
| // to COM components. If you need to access a type in this assembly from | |||||
| // COM, set the ComVisible attribute to true on that type. | |||||
| [assembly: ComVisible(false)] | |||||
| // The following GUID is for the ID of the typelib if this project is exposed to COM | |||||
| [assembly: Guid("ff948712-0f29-4c17-90ae-30221d8da53b")] | |||||
| // Version information for an assembly consists of the following four values: | |||||
| // | |||||
| // Major Version | |||||
| // Minor Version | |||||
| // Build Number | |||||
| // Revision | |||||
| // | |||||
| // You can specify all the values or you can default the Build and Revision Numbers | |||||
| // by using the '*' as shown below: | |||||
| // [assembly: AssemblyVersion("1.0.*")] | |||||
| [assembly: AssemblyVersion("1.0.0.0")] | |||||
| [assembly: AssemblyMapToTablePrefix("DogAuth_")] | |||||
| @ -0,0 +1,125 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <PropertyGroup> | |||||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||||
| <ProductVersion> | |||||
| </ProductVersion> | |||||
| <SchemaVersion>2.0</SchemaVersion> | |||||
| <ProjectGuid>{ACA4C314-5B8F-4888-9D58-49B925B233D6}</ProjectGuid> | |||||
| <OutputType>Library</OutputType> | |||||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||||
| <RootNamespace>Bwp.Web.Pages</RootNamespace> | |||||
| <AssemblyName>B3DogAuth.Web</AssemblyName> | |||||
| <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |||||
| <FileAlignment>512</FileAlignment> | |||||
| <KeyContainerName>TSingSoft</KeyContainerName> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||||
| <DebugSymbols>true</DebugSymbols> | |||||
| <DebugType>full</DebugType> | |||||
| <Optimize>false</Optimize> | |||||
| <OutputPath>bin\Debug\</OutputPath> | |||||
| <DefineConstants>TRACE;DEBUG;CODE_ANALYSIS</DefineConstants> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <WarningLevel>4</WarningLevel> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||||
| <DebugType>pdbonly</DebugType> | |||||
| <Optimize>true</Optimize> | |||||
| <OutputPath>bin\Release\</OutputPath> | |||||
| <DefineConstants>TRACE</DefineConstants> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <WarningLevel>4</WarningLevel> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | |||||
| <Reference Include="B3Frameworks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>..\..\..\tsref\Debug\B3Frameworks.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="B3Frameworks.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>..\..\..\tsref\Debug\B3Frameworks.Web.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="Forks.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||||
| <Private>False</Private> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="Forks.Utils, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||||
| <Private>False</Private> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="MainSystem, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> | |||||
| <Private>False</Private> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="MainSystem.Web, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> | |||||
| <Private>False</Private> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="System"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="System.Core"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="System.Web"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="System.Data"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="System.Web.Extensions" /> | |||||
| <Reference Include="System.Xml"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="TSingSoft.WebControls2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> | |||||
| <Private>False</Private> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="Wpf, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> | |||||
| <Private>False</Private> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="Wpf.System, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> | |||||
| <Private>False</Private> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| <Reference Include="Wpf.System.Web, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a04fa581c0f74d43, processorArchitecture=MSIL"> | |||||
| <Private>False</Private> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| </Reference> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <Compile Include="..\..\..\version\tslib_version.cs"> | |||||
| <Link>tslib_version.cs</Link> | |||||
| </Compile> | |||||
| <Compile Include="DogAuthLoginPlugin.cs" /> | |||||
| <Compile Include="DogLoginUserList.cs"> | |||||
| <SubType>ASPXCodeBehind</SubType> | |||||
| </Compile> | |||||
| <Compile Include="PluginClass.cs" /> | |||||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\DogAuth.BO\B3DogAuth.csproj"> | |||||
| <Project>{269C33B6-9ACC-4E3F-9BD2-B2AAB620E5DE}</Project> | |||||
| <Name>B3DogAuth</Name> | |||||
| <Private>False</Private> | |||||
| </ProjectReference> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <EmbeddedResource Include="DogLoginUserList.xml" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <EmbeddedResource Include="TSSecurityInstall2.exe" /> | |||||
| </ItemGroup> | |||||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||||
| Other similar extension points exist, see Microsoft.Common.targets. | |||||
| <Target Name="BeforeBuild"> | |||||
| </Target> | |||||
| <Target Name="AfterBuild"> | |||||
| </Target> | |||||
| --> | |||||
| </Project> | |||||
| @ -0,0 +1,402 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Web.UI.HtmlControls; | |||||
| using Bwp.Web.Pages.FrameworkPages; | |||||
| using TSingSoft.WebControls2; | |||||
| using TSingSoft.WebPluginFramework; | |||||
| using System.Web.UI; | |||||
| using TSingSoft.WebPluginFramework.Exports; | |||||
| using System.Web.UI.WebControls; | |||||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||||
| using System.Web; | |||||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||||
| using Forks.EnterpriseServices.DomainObjects2; | |||||
| using Bwp.MainSystem.BO; | |||||
| using Forks.EnterpriseServices.SqlDoms; | |||||
| using System.Collections.Concurrent; | |||||
| using System.Text; | |||||
| using System.Web.Script.Serialization; | |||||
| using BWP.B3DogAuth; | |||||
| using BWP.B3Frameworks.BL; | |||||
| using BWP.B3Frameworks.BO; | |||||
| using BWP.B3Frameworks.BO.NamedValueTemplate; | |||||
| [assembly: WebResource("Bwp.Web.Pages.TSSecurityInstall2.exe", Mimes.OctetStream)] | |||||
| namespace Bwp.Web.Pages { | |||||
| class DogAuthLoginPlugin : IWpfLoginPlugin { | |||||
| class GetUserInfo : WebControl, ICallbackEventHandler { | |||||
| public string GetCallbackResult() { | |||||
| return result; | |||||
| } | |||||
| string result = string.Empty; | |||||
| public void RaiseCallbackEvent(string eventArgument) { | |||||
| long dogNo; | |||||
| if (!long.TryParse(eventArgument, out dogNo)) { | |||||
| IUserBL userBL = BIFactory.Create<IUserBL>(); | |||||
| if (!userBL.Exist(eventArgument)) | |||||
| result = "用户不存在"; | |||||
| return; | |||||
| } | |||||
| IDogLoginUserBL bl = BIFactory.Create<IDogLoginUserBL>(); | |||||
| DogLoginUser user = bl.Load(dogNo); | |||||
| if (user == null) { | |||||
| result = "未配置"; | |||||
| } | |||||
| else { | |||||
| result = user.User_Name; | |||||
| } | |||||
| } | |||||
| } | |||||
| class SendMobileVerifyCode : WebControl, ICallbackEventHandler { | |||||
| string mResult = string.Empty; | |||||
| public string GetCallbackResult() { | |||||
| return mResult; | |||||
| } | |||||
| public void RaiseCallbackEvent(string eventArgument) { | |||||
| var serializer = new JavaScriptSerializer(); | |||||
| var info = serializer.Deserialize<Dictionary<string, string>>(eventArgument); | |||||
| var username = info["username"]; | |||||
| var password = info["password"]; | |||||
| var config = new DogAuthConfig(); | |||||
| if (config.CloseMobileVerifyCode) { | |||||
| bool loginByMobileVerifyCode = false; | |||||
| foreach (var user in config.CanLoginWithMobileVerifyCode.Value) { | |||||
| if (user == username) { | |||||
| loginByMobileVerifyCode = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| if (!loginByMobileVerifyCode) { | |||||
| mResult = "手机验证码登陆功能已关闭"; | |||||
| return; | |||||
| } | |||||
| } | |||||
| var wpfuser =new JoinAlias(typeof(WpfUser)); | |||||
| var pro = new JoinAlias(typeof(UserBasicProfile)); | |||||
| var query = new DQueryDom(pro); | |||||
| query.From.AddJoin(JoinType.Left,new DQDmoSource(wpfuser),DQCondition.EQ(wpfuser,"ID",pro,"ID") ); | |||||
| query.Where.Conditions.Add(DQCondition.EQ(wpfuser,"Name", username)); | |||||
| query.Columns.Add(DQSelectColumn.Field("Mobile",pro)); | |||||
| query.Range = SelectRange.Top(1); | |||||
| var mobile = query.EExecuteScalar<string>(); | |||||
| if (string.IsNullOrEmpty(mobile)) { | |||||
| mResult = string.Format("用户{0}不存在或未设置手机号", username); | |||||
| return; | |||||
| } | |||||
| var userBL = BIFactory.Create<IUserBL>(); | |||||
| try { | |||||
| userBL.ValidUser(username, password); | |||||
| } | |||||
| catch { | |||||
| mResult = "用户名或密码错误"; | |||||
| return; | |||||
| } | |||||
| var verifyCode = MobileAuthCenter.GenVerifyCode(username); | |||||
| var externalMessage = new ExternalMessage(); | |||||
| externalMessage.Content = string.Format("您的登录验证码是{0},5分钟后该验证码将失效", verifyCode); | |||||
| externalMessage.Receiver = mobile; | |||||
| externalMessage.ReceiverName = username; | |||||
| externalMessage.Type = ExternalMessageType.短信; | |||||
| try { | |||||
| var messageBL = BIFactory.Create<IExternalMessageBL>(); | |||||
| using (var scope = new WpfInternalUserScope()) { | |||||
| #if !DEBUG | |||||
| messageBL.Insert(externalMessage); | |||||
| #endif | |||||
| } | |||||
| mResult = "验证码已发送"; | |||||
| #if DEBUG | |||||
| mResult += verifyCode; | |||||
| #endif | |||||
| } | |||||
| catch (Exception ex) { | |||||
| mResult = string.Format("短信发送失败:" + ex.Message); | |||||
| } | |||||
| } | |||||
| } | |||||
| static HtmlTableRow CreateClientDogDownloadRow() { | |||||
| HtmlTableRow tr = new HtmlTableRow(); | |||||
| var cell = tr.EAdd(new HtmlTableCell { | |||||
| ColSpan = 2, | |||||
| Align = "center", | |||||
| InnerHtml = "<a id=\"lnkdownload\" style=\"visibility:hidden\" href=\"" + | |||||
| TSWebResource.GetUrl("Bwp.Web.Pages.TSSecurityInstall2.exe", typeof(DogAuthLoginPlugin).Assembly) + | |||||
| "\">下载黑贝客户端</a>" | |||||
| }); | |||||
| return tr; | |||||
| } | |||||
| GetUserInfo getUserInfo; | |||||
| SendMobileVerifyCode sendMobileVerifyCode; | |||||
| LinkButton switchDogButton; | |||||
| public void CreateExtraControls(WpfLogin self, HtmlTable tbl) { | |||||
| if (BrowserIsIE) { | |||||
| CreateExtraControl_IE(self, tbl); | |||||
| } | |||||
| else { | |||||
| CreateExtraControl_NotIE(self, tbl); | |||||
| } | |||||
| } | |||||
| TextBox verifyCodeInput; | |||||
| private void CreateExtraControl_NotIE(WpfLogin self, HtmlTable tbl) { | |||||
| sendMobileVerifyCode = new SendMobileVerifyCode(); | |||||
| tbl.Rows[0].Cells[0].Controls.Add(sendMobileVerifyCode); | |||||
| var row = new HtmlTableRow(); | |||||
| tbl.Rows.Insert(2, row); | |||||
| var cell1 = new HtmlTableCell(); | |||||
| cell1.ColSpan = 2; | |||||
| cell1.Attributes["class"] = "verifyCodeLabel"; | |||||
| row.Cells.Add(cell1); | |||||
| verifyCodeInput = new TextBox() { Width = Unit.Pixel(80) }; | |||||
| verifyCodeInput.CssClass = "verifyCodeInput"; | |||||
| verifyCodeInput.Attributes["placeholder"] = "输入验证码"; | |||||
| cell1.Controls.Add(verifyCodeInput); | |||||
| var row2 = new HtmlTableRow(); | |||||
| var verifyCodeCell = new HtmlTableCell(); | |||||
| verifyCodeCell.Style.Add(HtmlTextWriterStyle.Color, "red"); | |||||
| verifyCodeCell.Controls.Add(new LiteralControl("<span id='VerifyCodeInfo'></span>")); | |||||
| verifyCodeCell.ColSpan = 2; | |||||
| row2.Cells.Add(verifyCodeCell); | |||||
| tbl.Rows.Insert(3, row2); | |||||
| } | |||||
| private void CreateExtraControl_IE(WpfLogin self, HtmlTable tbl) { | |||||
| tbl.EAdd(CreateClientDogDownloadRow()); | |||||
| getUserInfo = new GetUserInfo(); | |||||
| HtmlTableRow tr = new HtmlTableRow(); | |||||
| HtmlTableCell td = new HtmlTableCell(); | |||||
| td.ColSpan = 2; | |||||
| tr.Cells.Add(td); | |||||
| tbl.Rows.Add(tr); | |||||
| td.Controls.Add(getUserInfo); | |||||
| switchDogButton = new LinkButton(); | |||||
| if (DogAuthPlugin.AllowNoDog) { | |||||
| td.Controls.Add(switchDogButton); | |||||
| switchDogButton.Click += (sender, e) => { | |||||
| if (!mAllowNoDog) { | |||||
| self.Page.Response.Cookies.Add(new HttpCookie("NoDog", "NoDog") { Expires = DateTime.MaxValue }); | |||||
| AspUtil.Redirect(self.Page.Request.RawUrl); | |||||
| self.Page.Response.Redirect(self.Page.Request.RawUrl); | |||||
| } | |||||
| else { | |||||
| self.Page.Response.Cookies["NoDog"].Expires = DateTime.Now.AddYears(-1); | |||||
| AspUtil.Redirect(self.Page.Request.RawUrl); | |||||
| } | |||||
| }; | |||||
| } | |||||
| } | |||||
| public void InitPamContext(WpfLogin self, IDictionary<string, object> pamContext) { | |||||
| //这里不能根据verifyCodeInput是否为空来判断,当verifyCodeInput被用到后就不再为空 | |||||
| //可能和asp.net页面的内部机制有关系 | |||||
| if (!BrowserIsIE && verifyCodeInput != null) { | |||||
| pamContext.Add("VerifyCode", verifyCodeInput.Text); | |||||
| } | |||||
| } | |||||
| bool BrowserIsIE { | |||||
| get { | |||||
| return BrowserContext.Current.Browser == "IE"; | |||||
| } | |||||
| } | |||||
| bool mAllowNoDog = false; | |||||
| public void OnLoad(WpfLogin self) { | |||||
| if (BrowserIsIE) { | |||||
| mAllowNoDog = DogAuthPlugin.AllowNoDog && self.Page.Request.Cookies["NoDog"] != null; | |||||
| if (!mAllowNoDog) { | |||||
| switchDogButton.Text = "切换到不使用黑贝登录"; | |||||
| self.UserNameTextBox.ReadOnly = true; | |||||
| RegisterClientDog(self); | |||||
| } | |||||
| else { | |||||
| switchDogButton.Text = "切换到使用黑贝登录"; | |||||
| } | |||||
| } | |||||
| else { | |||||
| RegisterMobileLogin(self); | |||||
| } | |||||
| } | |||||
| private void RegisterMobileLogin(WpfLogin self) { | |||||
| var script = @" | |||||
| function GetVerifyCode(){ | |||||
| var username = $('input[type=text]:first').val(); | |||||
| var password = $('input[type=password]:first').val(); | |||||
| var callbackdata = JSON.stringify({username:username,password:password}); | |||||
| {Callback} | |||||
| } | |||||
| function ReceiveServerData(value){ | |||||
| $('#VerifyCodeInfo').text(value); | |||||
| } | |||||
| $(""<a id='getverifycode' class='getverifycode' href=\""javascript:GetVerifyCode();\"">获取验证码</a>"").insertAfter(""input[type=password]:first"") | |||||
| "; | |||||
| script = script.Replace("{Callback}", self.Page.ClientScript.GetCallbackEventReference(sendMobileVerifyCode, "callbackdata", "ReceiveServerData", null)); | |||||
| self.Page.ClientScript.RegisterStartupScript(typeof(WpfLogin), "ClientDog", script, true); | |||||
| } | |||||
| void RegisterClientDog(WpfLogin self) { | |||||
| self.UserNameTextBox.Attributes["onchange"] = "SetDogInfo();"; | |||||
| string script = | |||||
| "var dogDate='" + new DateTime(2000, 1, 1).ToString("yyyy-MM-dd") + "';" + | |||||
| "var uid=document.all." + self.UserNameTextBox.ClientID + ";" + | |||||
| "var btn=document.all." + self.LoginButton.ClientID + ";" + | |||||
| @" | |||||
| btn.disabled = true; | |||||
| var checkObj; | |||||
| var dog = -1; | |||||
| function SetDogInfo() | |||||
| { | |||||
| {Callback} | |||||
| } | |||||
| function ReceiveServerData(value) | |||||
| { | |||||
| var span = uid.nextSibling; | |||||
| if(span == null || span.tagName != 'SPAN') | |||||
| { | |||||
| span = document.createElement('span'); | |||||
| $(span).css('color',$(uid).css('color')); | |||||
| $(span).css('fontSize',$(uid).css('fontSize')); | |||||
| $(span).css('fontFamily',$(uid).css('fontFamily')); | |||||
| uid.insertAdjacentElement('afterEnd',span); | |||||
| } | |||||
| span.innerText = value; | |||||
| span.innerText += '|' + uid.value;; | |||||
| } | |||||
| function CheckSign() { | |||||
| if(checkObj.DogNo == dog) { | |||||
| dog = checkObj.DogNo; | |||||
| window.setTimeout('CheckSign()',1000); | |||||
| return; | |||||
| } | |||||
| var msg = checkObj.CheckSign(dogDate); | |||||
| if(msg != '') { | |||||
| var result = confirm(msg+',继续吗?'); | |||||
| if(!result){return;} | |||||
| uid.value = ''; | |||||
| btn.disabled = true; | |||||
| window.setTimeout('CheckSign()',1000); | |||||
| } else { | |||||
| dog = checkObj.DogNo; | |||||
| uid.value=dog; | |||||
| SetDogInfo(); | |||||
| uid.style.display='none'; | |||||
| btn.disabled = false; | |||||
| window.setTimeout('CheckSign()',1000); | |||||
| } | |||||
| } | |||||
| var driverInstall = false; | |||||
| try { | |||||
| checkObj = new ActiveXObject('TSSecurity.UserSign'); | |||||
| driverInstall = true; | |||||
| } catch(e) { | |||||
| lnkdownload.style.visibility = 'visible'; | |||||
| alert('没有安装客户端狗的驱动,不能使用本系统.'); | |||||
| } | |||||
| if(driverInstall == true) | |||||
| CheckSign(); | |||||
| "; | |||||
| script = script.Replace("{Callback}", self.Page.ClientScript.GetCallbackEventReference(getUserInfo, "uid.value", "ReceiveServerData", null)); | |||||
| self.Page.ClientScript.RegisterStartupScript(typeof(WpfLogin), "ClientDog", script, true); | |||||
| // RegisterAjaxScript(self.Page); | |||||
| } | |||||
| // public void RegisterAjaxScript(Page page) { | |||||
| // const string script = @" | |||||
| //<script language=javascript> | |||||
| //function Ajax() | |||||
| //{ | |||||
| //} | |||||
| // | |||||
| //Ajax.WaitResult = function(xmlHttp,doResultF) | |||||
| //{ | |||||
| // xmlHttp.onreadystatechange = function() | |||||
| // { | |||||
| // if(xmlHttp.readyState != 4) return; | |||||
| // if(xmlHttp.status != 200) | |||||
| // { | |||||
| // alert ('所请求的页面出现问题' + xmlHttp.statusText); | |||||
| // xmlHttp = null; | |||||
| // return; | |||||
| // } | |||||
| // var rootNode = xmlHttp.responseXML; | |||||
| // xmlHttp = null; | |||||
| // if(rootNode == null) | |||||
| // { | |||||
| // alert('未能从页面返回结果中得到xml数据'); | |||||
| // return; | |||||
| // } | |||||
| // | |||||
| // var successNode = hal.selectSingleNode(rootNode,'//Success'); | |||||
| // if(successNode.firstChild.data != '1') | |||||
| // { | |||||
| // var descriptionNode = hal.selectSingleNode(rootNode,'//Description'); | |||||
| // alert(descriptionNode.firstChild.data); | |||||
| // return; | |||||
| // } | |||||
| // var resultNode = hal.selectSingleNode(rootNode,'//Result'); | |||||
| // var result; | |||||
| // if(resultNode.firstChild.nodeType == 8){ | |||||
| // result = resultNode.firstChild.data; | |||||
| // if(hal.selectSingleNode(rootNode,'//ResultIsJson') != null){ | |||||
| // result = eval('(' + result + ')'); | |||||
| // } | |||||
| // } | |||||
| // else if(resultNode.firstChild.nodeName == 'Row') | |||||
| // { | |||||
| // result = new Object(); | |||||
| // for(var i=0;i<resultNode.firstChild.attributes.length;i++) | |||||
| // eval('result.' +resultNode.firstChild.attributes.item(i).name + '=hal.getNodeText(resultNode.firstChild.attributes.item(i))'); | |||||
| // } | |||||
| // doResultF(result); | |||||
| // } | |||||
| //} | |||||
| // | |||||
| //Ajax.Get = function(url,doResultF) | |||||
| //{ | |||||
| // var xmlHttp = hal.createXmlHttp(); | |||||
| // xmlHttp.open('GET', url , false); | |||||
| // Ajax.WaitResult(xmlHttp,doResultF); | |||||
| // xmlHttp.send(null); | |||||
| //} | |||||
| // | |||||
| //Ajax.Post = function(url,postData,doResultF) | |||||
| //{ | |||||
| // var xmlHttp = hal.createXmlHttp(); | |||||
| // xmlHttp.open('POST',url, false); | |||||
| // xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | |||||
| // Ajax.WaitResult(xmlHttp,doResultF); | |||||
| // xmlHttp.send(postData); | |||||
| //}</script>"; | |||||
| // page.ClientScript.RegisterClientScriptBlock(page.GetType(), "Ajax", script); | |||||
| // } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,92 @@ | |||||
| using System; | |||||
| using TSingSoft.Web.Pages; | |||||
| using TSingSoft.WebControls2; | |||||
| using System.Web.UI; | |||||
| using BWP.B3DogAuth; | |||||
| using BWP.B3Frameworks; | |||||
| using BWP.Web; | |||||
| using BWP.Web.Utils; | |||||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||||
| namespace Bwp.Web.Pages { | |||||
| class DogLoginUserList : ListPage<DogLoginUser> { | |||||
| protected override void CreateDFBrowseGridColumns(DFBrowseGrid grid) { | |||||
| AddDFBrowseGridColumn(grid, "ID"); | |||||
| AddDFBrowseGridColumn(grid, "User_Name"); | |||||
| AddDFBrowseGridColumn(grid, "Remark"); | |||||
| AddDFBrowseGridColumn(grid, "Stopped"); | |||||
| grid.AllowDeletion = CheckDefaultRole("删除"); | |||||
| } | |||||
| protected override void InitGridToolbar(HLayoutPanel toolbar) { | |||||
| AddInputControls(toolbar ); | |||||
| } | |||||
| private IDogLoginUserBL bl = BIFactory.Create<IDogLoginUserBL>(); | |||||
| void AddInputControls(HLayoutPanel hPanel) { | |||||
| if (!CheckDefaultRole("新建")) | |||||
| return; | |||||
| var dfContainer = new DFContainer<DogLoginUser>(); | |||||
| hPanel.Add(new LiteralControl("序号:")); | |||||
| DFTextBox idInput = hPanel.Add(dfContainer.Add(InputCreator.DFTextBox, "ID")); | |||||
| hPanel.Add(new LiteralControl("用户:")); | |||||
| DFChoiceBox userInput = hPanel.Add(dfContainer.Add(InputCreator.DFChoiceBox("Wpf_Users", "User_Name"), "User_ID")); | |||||
| hPanel.Add(new LiteralControl("备注:")); | |||||
| DFTextBox remarkInput = hPanel.Add(dfContainer.Add(InputCreator.DFTextBoxFromRemark, "Remark")); | |||||
| TSButton button = new TSButton("新建"); | |||||
| hPanel.Add(button); | |||||
| button.Click += delegate(object sender, EventArgs e) { | |||||
| dfContainer.DFObject = new DogLoginUser(); | |||||
| dfContainer.GetFromUI(); | |||||
| bl.Insert(dfContainer.DFObject); | |||||
| idInput.Text = string.Empty; | |||||
| userInput.Value = string.Empty; | |||||
| userInput.DisplayValue = string.Empty; | |||||
| remarkInput.Text = string.Empty; | |||||
| StartQuery(); | |||||
| }; | |||||
| } | |||||
| protected override void AddQueryControls(VLayoutPanel vPanel) { | |||||
| var tablePanel = new TableLayoutPanel(8, 2); | |||||
| vPanel.Add(tablePanel); | |||||
| int row = 0; | |||||
| const int labelWidth = 4; | |||||
| tablePanel.Add(0, 1, row, row + 1, new DFLabel(mDFInfo.Fields["ID"], labelWidth)); | |||||
| tablePanel.Add(1, 2, row, row + 1, mQueryContainer.Add(new DFTextBox(mDFInfo.Fields["ID"]), "ID")); | |||||
| tablePanel.Add(2, 3, row, row + 1, new DFLabel(mDFInfo.Fields["User_Name"], 4)); | |||||
| tablePanel.Add(3, 4, row, row + 1, mQueryContainer.Add(new DFTextBox(mDFInfo.Fields["User_Name"]), "User_Name")); | |||||
| tablePanel.Add(4, 5, row, row + 1, new SimpleLabel("是否停用", 4)); | |||||
| DFBoolComboBox boolComboBox; | |||||
| tablePanel.Add(5, 6, row, row + 1, boolComboBox = mQueryContainer.Add(QueryCreator.DFBoolComboBox(mDFInfo.Fields["Stopped"]), "Stopped")); | |||||
| boolComboBox.Value = false; | |||||
| tablePanel.Add(6, 7, row, row + 1, new DFLabel(mDFInfo.Fields["Remark"], 4)); | |||||
| tablePanel.Add(7,8, row, row + 1, mQueryContainer.Add(new DFTextBox(mDFInfo.Fields["Remark"]), "Remark")); | |||||
| } | |||||
| protected bool CheckDefaultRole(string lastRoleName, bool notExistsAsTrue = false) { | |||||
| string fullRoleName = PluginName + "." + LogicName + "." + lastRoleName; | |||||
| return CurrentUser.EIsInRole(fullRoleName, notExistsAsTrue); | |||||
| } | |||||
| protected override void OnLoad(EventArgs e) | |||||
| { | |||||
| base.OnLoad(e); | |||||
| if (!IsPostBack) | |||||
| { | |||||
| StartQuery(); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,29 @@ | |||||
| <?xml version="1.0" encoding="utf-8" ?> | |||||
| <Select xmlns="urn:XDQuery"> | |||||
| <Columns> | |||||
| <Field name="ID"/> | |||||
| </Columns> | |||||
| <From> | |||||
| <DmoClass class="BWP.B3DogAuth.DogLoginUser, B3DogAuth"/> | |||||
| </From> | |||||
| <Where> | |||||
| <And> | |||||
| <EQ> | |||||
| <Field name="ID"/> | |||||
| <QBE paramName="ID"/> | |||||
| </EQ> | |||||
| <EQ> | |||||
| <Field name="Stopped"/> | |||||
| <QBE paramName="Stopped"/> | |||||
| </EQ> | |||||
| <Contains> | |||||
| <Field name="User_Name"/> | |||||
| <QBE paramName="User_Name"/> | |||||
| </Contains> | |||||
| <Contains> | |||||
| <Field name="Remark"/> | |||||
| <QBE paramName="Remark"/> | |||||
| </Contains> | |||||
| </And> | |||||
| </Where> | |||||
| </Select> | |||||
| @ -0,0 +1,24 @@ | |||||
| | |||||
| using Bwp.MainSystem; | |||||
| using Bwp.Web.Pages.FrameworkPages; | |||||
| using Forks.Utils; | |||||
| using TSingSoft.WebPluginFramework; | |||||
| using TSingSoft.WebPluginFramework.DefinedParameters; | |||||
| using BWP.B3DogAuth; | |||||
| namespace Bwp.Web.Pages { | |||||
| class PluginClass : IPluginClass { | |||||
| const string PluginName = "B3DogAuth"; | |||||
| public void OnInit() { | |||||
| Config.GlobalVars.Add("ClientDogCheck", true); | |||||
| Global.RegisterCustomPrePam(new DogAuthPlugin()); | |||||
| WpfLogin.RegisterPlugin(new DogAuthLoginPlugin()); | |||||
| var plugin = PluginManager.Current.FindByName(PluginName); | |||||
| Wpf.ParameterManager.Define(plugin, Parameter.Boolean(PluginName + ".AllowUnConfigedDog", "允许不使用黑贝登录", true)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,38 @@ | |||||
| using System.Reflection; | |||||
| using System.Runtime.CompilerServices; | |||||
| using System.Runtime.InteropServices; | |||||
| using TSingSoft.WebPluginFramework; | |||||
| // General Information about an assembly is controlled through the following | |||||
| // set of attributes. Change these attribute values to modify the information | |||||
| // associated with an assembly. | |||||
| [assembly: AssemblyTitle("DogNoAuth.Web")] | |||||
| [assembly: AssemblyDescription("")] | |||||
| [assembly: AssemblyConfiguration("")] | |||||
| [assembly: AssemblyCompany("")] | |||||
| [assembly: AssemblyProduct("DogNoAuth.Web")] | |||||
| [assembly: AssemblyCopyright("Copyright © 2008")] | |||||
| [assembly: AssemblyTrademark("")] | |||||
| [assembly: AssemblyCulture("")] | |||||
| // Setting ComVisible to false makes the types in this assembly not visible | |||||
| // to COM components. If you need to access a type in this assembly from | |||||
| // COM, set the ComVisible attribute to true on that type. | |||||
| [assembly: ComVisible(false)] | |||||
| // The following GUID is for the ID of the typelib if this project is exposed to COM | |||||
| [assembly: Guid("71bc7718-5d5e-4c37-8c6e-62473254eb12")] | |||||
| // Version information for an assembly consists of the following four values: | |||||
| // | |||||
| // Major Version | |||||
| // Minor Version | |||||
| // Build Number | |||||
| // Revision | |||||
| // | |||||
| // You can specify all the values or you can default the Build and Revision Numbers | |||||
| // by using the '*' as shown below: | |||||
| // [assembly: AssemblyVersion("1.0.*")] | |||||
| [assembly: AssemblyVersion("1.0.0.0")] | |||||
| @ -0,0 +1,74 @@ | |||||
| | |||||
| Microsoft Visual Studio Solution File, Format Version 11.00 | |||||
| # Visual Studio 2010 | |||||
| Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebFolder", "WebFolder\", "{E469B325-BFC0-43BD-A2D9-608CEA64291E}" | |||||
| ProjectSection(WebsiteProperties) = preProject | |||||
| TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0" | |||||
| ProjectReferences = "{ACA4C314-5B8F-4888-9D58-49B925B233D6}|DogAuth.Web.dll;{269C33B6-9ACC-4E3F-9BD2-B2AAB620E5DE}|DogAuth.BO.dll;" | |||||
| Debug.AspNetCompiler.VirtualPath = "/WebFolder" | |||||
| Debug.AspNetCompiler.PhysicalPath = "WebFolder\" | |||||
| Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\WebFolder\" | |||||
| Debug.AspNetCompiler.Updateable = "true" | |||||
| Debug.AspNetCompiler.ForceOverwrite = "true" | |||||
| Debug.AspNetCompiler.FixedNames = "false" | |||||
| Debug.AspNetCompiler.Debug = "True" | |||||
| Release.AspNetCompiler.VirtualPath = "/WebFolder" | |||||
| Release.AspNetCompiler.PhysicalPath = "WebFolder\" | |||||
| Release.AspNetCompiler.TargetPath = "PrecompiledWeb\WebFolder\" | |||||
| Release.AspNetCompiler.Updateable = "true" | |||||
| Release.AspNetCompiler.ForceOverwrite = "true" | |||||
| Release.AspNetCompiler.FixedNames = "false" | |||||
| Release.AspNetCompiler.Debug = "False" | |||||
| VWDPort = "42895" | |||||
| DefaultWebSiteLanguage = "Visual C#" | |||||
| EndProjectSection | |||||
| EndProject | |||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "B3DogAuth", "DogAuth.BO\B3DogAuth.csproj", "{269C33B6-9ACC-4E3F-9BD2-B2AAB620E5DE}" | |||||
| EndProject | |||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "B3DogAuth.Web", "DogAuth.Web\B3DogAuth.Web.csproj", "{ACA4C314-5B8F-4888-9D58-49B925B233D6}" | |||||
| EndProject | |||||
| Global | |||||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||||
| Debug|.NET = Debug|.NET | |||||
| Debug|Any CPU = Debug|Any CPU | |||||
| Debug|Mixed Platforms = Debug|Mixed Platforms | |||||
| Release|.NET = Release|.NET | |||||
| Release|Any CPU = Release|Any CPU | |||||
| Release|Mixed Platforms = Release|Mixed Platforms | |||||
| EndGlobalSection | |||||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | |||||
| {E469B325-BFC0-43BD-A2D9-608CEA64291E}.Debug|.NET.ActiveCfg = Debug|.NET | |||||
| {E469B325-BFC0-43BD-A2D9-608CEA64291E}.Debug|.NET.Build.0 = Debug|.NET | |||||
| {E469B325-BFC0-43BD-A2D9-608CEA64291E}.Debug|Any CPU.ActiveCfg = Debug|.NET | |||||
| {E469B325-BFC0-43BD-A2D9-608CEA64291E}.Debug|Mixed Platforms.ActiveCfg = Debug|.NET | |||||
| {E469B325-BFC0-43BD-A2D9-608CEA64291E}.Debug|Mixed Platforms.Build.0 = Debug|.NET | |||||
| {E469B325-BFC0-43BD-A2D9-608CEA64291E}.Release|.NET.ActiveCfg = Debug|.NET | |||||
| {E469B325-BFC0-43BD-A2D9-608CEA64291E}.Release|.NET.Build.0 = Debug|.NET | |||||
| {E469B325-BFC0-43BD-A2D9-608CEA64291E}.Release|Any CPU.ActiveCfg = Debug|.NET | |||||
| {E469B325-BFC0-43BD-A2D9-608CEA64291E}.Release|Mixed Platforms.ActiveCfg = Debug|.NET | |||||
| {E469B325-BFC0-43BD-A2D9-608CEA64291E}.Release|Mixed Platforms.Build.0 = Debug|.NET | |||||
| {269C33B6-9ACC-4E3F-9BD2-B2AAB620E5DE}.Debug|.NET.ActiveCfg = Debug|Any CPU | |||||
| {269C33B6-9ACC-4E3F-9BD2-B2AAB620E5DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
| {269C33B6-9ACC-4E3F-9BD2-B2AAB620E5DE}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
| {269C33B6-9ACC-4E3F-9BD2-B2AAB620E5DE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU | |||||
| {269C33B6-9ACC-4E3F-9BD2-B2AAB620E5DE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU | |||||
| {269C33B6-9ACC-4E3F-9BD2-B2AAB620E5DE}.Release|.NET.ActiveCfg = Release|Any CPU | |||||
| {269C33B6-9ACC-4E3F-9BD2-B2AAB620E5DE}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
| {269C33B6-9ACC-4E3F-9BD2-B2AAB620E5DE}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
| {269C33B6-9ACC-4E3F-9BD2-B2AAB620E5DE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU | |||||
| {269C33B6-9ACC-4E3F-9BD2-B2AAB620E5DE}.Release|Mixed Platforms.Build.0 = Release|Any CPU | |||||
| {ACA4C314-5B8F-4888-9D58-49B925B233D6}.Debug|.NET.ActiveCfg = Debug|Any CPU | |||||
| {ACA4C314-5B8F-4888-9D58-49B925B233D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
| {ACA4C314-5B8F-4888-9D58-49B925B233D6}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
| {ACA4C314-5B8F-4888-9D58-49B925B233D6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU | |||||
| {ACA4C314-5B8F-4888-9D58-49B925B233D6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU | |||||
| {ACA4C314-5B8F-4888-9D58-49B925B233D6}.Release|.NET.ActiveCfg = Release|Any CPU | |||||
| {ACA4C314-5B8F-4888-9D58-49B925B233D6}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
| {ACA4C314-5B8F-4888-9D58-49B925B233D6}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
| {ACA4C314-5B8F-4888-9D58-49B925B233D6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU | |||||
| {ACA4C314-5B8F-4888-9D58-49B925B233D6}.Release|Mixed Platforms.Build.0 = Release|Any CPU | |||||
| EndGlobalSection | |||||
| GlobalSection(SolutionProperties) = preSolution | |||||
| HideSolutionNode = FALSE | |||||
| EndGlobalSection | |||||
| EndGlobal | |||||
| @ -0,0 +1,25 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <Plugin appVersion="$appVersion" displayName="黑贝认证" name="B3DogAuth" pluginClass="Bwp.Web.Pages.PluginClass, B3DogAuth.Web" schemaVersion="1.0" version="1.0" xmlns="http://www.TSingSoft.com/Schemas/WPF.xsd" sortOrder="-9300"> | |||||
| <Requires> | |||||
| <Plugin name="MainSystem" version="1.0"/> | |||||
| <Plugin name="B3Frameworks" version="1.0"/> | |||||
| </Requires> | |||||
| <Assemblies> | |||||
| <File name="B3DogAuth.dll" type="bo bl"/> | |||||
| <File name="B3DogAuth.Web.dll" type="web"/> | |||||
| </Assemblies> | |||||
| <Security> | |||||
| <FunctionGroup features="B3DogAuth.0001" name="黑贝认证" roleSchemas="default" > | |||||
| <Function index="0" name="访问"/> | |||||
| <Function index="1" name="新建"/> | |||||
| <Function index="2" name="删除"/> | |||||
| </FunctionGroup> | |||||
| </Security> | |||||
| <Menus> | |||||
| <Menu features="B3DogAuth.0001" id="0001" name="/系统工具/黑贝认证" roles="B3DogAuth.黑贝认证.访问" url="DogLoginUserList.aspx"/> | |||||
| </Menus> | |||||
| <Features> | |||||
| <Feature id="0001" name="黑贝认证"/> | |||||
| </Features> | |||||
| </Plugin> | |||||