Skip to content

Commit

Permalink
Merge pull request #3 from OmidID/migrate-to-microsoft-identity
Browse files Browse the repository at this point in the history
Migrate to microsoft identity
  • Loading branch information
OmidID authored Sep 25, 2020
2 parents 2782317 + 9cd0bba commit b1fd113
Show file tree
Hide file tree
Showing 144 changed files with 8,813 additions and 1,161 deletions.
36 changes: 36 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/DotNetBlog.Web/bin/Debug/netcoreapp3.1/DotNetBlog.Web.dll",
"args": [],
"cwd": "${workspaceFolder}/src/DotNetBlog.Web",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
42 changes: 42 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/src/DotNetBlog.Web/DotNetBlog.Web.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/src/DotNetBlog.Web/DotNetBlog.Web.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/src/DotNetBlog.Web/DotNetBlog.Web.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
6 changes: 6 additions & 0 deletions build/CommonDependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Localization" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="$(AspNetLibrariesVersion)" />
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="$(AspNetLibrariesVersion)" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="$(AspNetLibrariesVersion)" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(AspNetLibrariesVersion)" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />

<PackageReference Include="NLog.Extensions.Logging" Version="$(NLogVersion)" />
Expand All @@ -22,10 +25,13 @@
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(EfLibrariesVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(EfLibrariesVersion)" />
<PackageReference Include="MySql.Data.EntityFrameworkCore" Version="$(EfMySqlVersion)" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(EfNpgSqlVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="$(EfLibrariesVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions build/Definitions.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<PropertyGroup>
<AspNetLibrariesVersion>3.1.6</AspNetLibrariesVersion>
<EfLibrariesVersion>3.1.6</EfLibrariesVersion>
<EfMySqlVersion>8.0.21</EfMySqlVersion>
<EfNpgSqlVersion>3.1.4</EfNpgSqlVersion>
<AutoMapperVersion>10.0.0</AutoMapperVersion>
<NewtonsoftJsonVersion>12.0.3</NewtonsoftJsonVersion>
<HumanizerVersion>2.8.26</HumanizerVersion>
Expand Down
4 changes: 4 additions & 0 deletions build/Web.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@

<PackageReference Include="NLog.Extensions.Hosting" Version="$(NLogVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="$(AspNetLibrariesVersion)" />

<PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="$(AspNetLibrariesVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="$(AspNetLibrariesVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="$(AspNetLibrariesVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
17 changes: 1 addition & 16 deletions src/DotNetBlog.Admin/consts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ const MenuKeys = {
Config_Feed: "Menu_Config_Feed",
Config_Comments: "Menu_Config_Comments",
Config_Advance: "Menu_Config_Advance",
User: "Menu_User",
User_Profile: "Menu_User_Profile"
User: "Menu_User"
}

const Menus = [
Expand Down Expand Up @@ -114,20 +113,6 @@ const Menus = [
url: "config/advance"
}
]
},
{
key: MenuKeys.User,
text: "user".L(),
url: "user/profile",
icon: "fa fa-user",
hide: true,
children: [
{
key: MenuKeys.User_Profile,
text: "personalInformation".L(),
url: "user/profile"
}
]
}
]

Expand Down
2 changes: 0 additions & 2 deletions src/DotNetBlog.Admin/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ var Views_PageList = require("./views/content/pagelist")
var Views_ModifyPage = require("./views/content/modifypage")
var Views_CommentList = require("./views/content/commentlist")
var Views_CommentConfig = require("./views/config/commentconfig")
var Views_Profile = require("./views/user/profile")
var Views_Widgets = require("./views/widget/widgets")

const history = useRouterHistory(createHistory)({
Expand Down Expand Up @@ -58,7 +57,6 @@ class Index extends React.Component{
<Route path="content/pages" component={Views_PageList} onEnter={enterRoute.bind(this, Consts.MenuKeys.Content, Consts.MenuKeys.Content_Pages)}/>
<Route path="content/page(/:id)" component={Views_ModifyPage} onEnter={enterRoute.bind(this, Consts.MenuKeys.Content, Consts.MenuKeys.Content_Pages)}/>
<Route path="custom/widgets" component={Views_Widgets} onEnter={enterRoute.bind(this, Consts.MenuKeys.Custom, Consts.MenuKeys.Custom_Widgets)}/>
<Route path="profile" component={Views_Profile} onEnter={enterRoute.bind(this, Consts.MenuKeys.User, Consts.MenuKeys.User_Profile)}/>
</Route>
</Router>
</Provider>
Expand Down
2 changes: 2 additions & 0 deletions src/DotNetBlog.Admin/resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ const Localization = new LocalizedStrings({
blogAddress: "Blog address",
numberOfArticlesPerPage: "Number of articles per page",
showOnlyArticleSummary: "Show only article summary",
registration: "Registration",
never: "Never",
numericDay: {
1: "a day",
Expand Down Expand Up @@ -284,6 +285,7 @@ const Localization = new LocalizedStrings({
blogAddress: "博客地址",
numberOfArticlesPerPage: "每页文章数",
showOnlyArticleSummary: "仅显示文章摘要",
registration: "注册",
never: "从不",
numericDay: {
default: "{0}天"
Expand Down
6 changes: 3 additions & 3 deletions src/DotNetBlog.Admin/views/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ class App extends React.Component{
</a>
<div className="navbar-custom-menu">
<ul className="nav navbar-nav">
<li><a href="/account/changepassword">{"changePassword".L()}</a></li>
<li><a href="/Identity/Account/Manage/ChangePassword">{"changePassword".L()}</a></li>
<li>
<a href="/account/logoff">
<a href="/Identity/Account/Logout">
<i className="fa fa-exit"></i>
{"logoff".L()}
</a>
Expand All @@ -99,7 +99,7 @@ class App extends React.Component{
</div>
<div className="pull-left info">
<p>
<Link to="profile">{user.nickname}</Link>
<b>{user.nickname}</b>
</p>

<span>
Expand Down
14 changes: 11 additions & 3 deletions src/DotNetBlog.Admin/views/config/basicconfig.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class BasicConfigForm extends React.Component{
this.languageOptions = Localization.getAvailableLanguages();
}

render(){
const {fields: {host, title, description, language, theme, topicsPerPage, onlyShowSummary}, handleSubmit, themes} = this.props
render() {
const { fields: { host, title, description, language, theme, topicsPerPage, onlyShowSummary, registration }, handleSubmit, themes } = this.props
return (
<form noValidate onSubmit={handleSubmit}>
<FormGroup label={"blogAddress".L()} validation={host}>
Expand Down Expand Up @@ -76,6 +76,14 @@ class BasicConfigForm extends React.Component{
</label>
</div>
</FormGroup>
<FormGroup>
<div className="checkbox">
<label>
<input type="checkbox" {...registration} />
{"registration".L()}
</label>
</div>
</FormGroup>
<FormGroup>
<button type="submit" className="btn btn-primary">
{"save".L()}
Expand All @@ -89,7 +97,7 @@ class BasicConfigForm extends React.Component{

BasicConfigForm = reduxForm({
form: "basicConfigForm",
fields: ["host", "title", "description", "language", "topicsPerPage", "onlyShowSummary"],
fields: ["host", "title", "description", "language", "topicsPerPage", "onlyShowSummary", "registration"],
validate
})(BasicConfigForm)

Expand Down
121 changes: 0 additions & 121 deletions src/DotNetBlog.Admin/views/user/profile.jsx

This file was deleted.

Loading

0 comments on commit b1fd113

Please sign in to comment.