items, int selectedValue)
10 | {
11 | return from item in items
12 | select new SelectListItem
13 | {
14 | Text = item.GetPropertyValue("Name"),
15 | Value = item.GetPropertyValue("Id"),
16 | Selected = item.GetPropertyValue("Id").Equals(selectedValue.ToString())
17 | };
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Spice/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:13314",
7 | "sslPort": 44333
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "Spice": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
22 | "environmentVariables": {
23 | "ASPNETCORE_ENVIRONMENT": "Development"
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Spice/Areas/Admin/Views/Category/Delete.cshtml:
--------------------------------------------------------------------------------
1 | @model Category
2 |
3 | @{
4 | ViewData["Title"] = "Delete";
5 | Layout = "~/Views/Shared/_Layout.cshtml";
6 | }
7 |
8 |
9 | Delete Category
10 |
11 |
12 |
30 |
31 | @section Scripts{
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/ForgotPassword.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ForgotPasswordModel
3 | @{
4 | ViewData["Title"] = "Forgot your password?";
5 | }
6 |
7 | @ViewData["Title"]
8 | Enter your email.
9 |
10 |
23 |
24 | @section Scripts {
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/Manage/Disable2fa.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model Disable2faModel
3 | @{
4 | ViewData["Title"] = "Disable two-factor authentication (2FA)";
5 | ViewData["ActivePage"] = ManageNavPages.TwoFactorAuthentication;
6 | }
7 |
8 |
9 | @ViewData["Title"]
10 |
11 |
12 |
13 | This action only disables 2FA.
14 |
15 |
16 | Disabling 2FA does not change the keys used in authenticator apps. If you wish to change the key
17 | used in an authenticator app you should reset your authenticator keys.
18 |
19 |
20 |
21 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/Manage/ShowRecoveryCodes.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ShowRecoveryCodesModel
3 | @{
4 | ViewData["Title"] = "Recovery codes";
5 | ViewData["ActivePage"] = "TwoFactorAuthentication";
6 | }
7 |
8 |
9 | @ViewData["Title"]
10 |
11 |
12 | Put these codes in a safe place.
13 |
14 |
15 | If you lose your device and don't have the recovery codes you will lose access to your account.
16 |
17 |
18 |
19 |
20 | @for (var row = 0; row < Model.RecoveryCodes.Length; row += 2)
21 | {
22 | @Model.RecoveryCodes[row] @Model.RecoveryCodes[row + 1]
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/Manage/ShowRecoveryCodes.cshtml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Identity;
6 | using Microsoft.AspNetCore.Mvc;
7 | using Microsoft.AspNetCore.Mvc.RazorPages;
8 | using Microsoft.Extensions.Logging;
9 |
10 | namespace Spice.Areas.Identity.Pages.Account.Manage
11 | {
12 | public class ShowRecoveryCodesModel : PageModel
13 | {
14 | [TempData]
15 | public string[] RecoveryCodes { get; set; }
16 |
17 | [TempData]
18 | public string StatusMessage { get; set; }
19 |
20 | public IActionResult OnGet()
21 | {
22 | if (RecoveryCodes == null || RecoveryCodes.Length == 0)
23 | {
24 | return RedirectToPage("./TwoFactorAuthentication");
25 | }
26 |
27 | return Page();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ErrorModel
3 | @{
4 | ViewData["Title"] = "Error";
5 | }
6 |
7 | Error.
8 | An error occurred while processing your request.
9 |
10 | @if (Model.ShowRequestId)
11 | {
12 |
13 | Request ID: @Model.RequestId
14 |
15 | }
16 |
17 | Development Mode
18 |
19 | Swapping to Development environment will display more detailed information about the error that occurred.
20 |
21 |
22 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.
23 |
24 |
--------------------------------------------------------------------------------
/Spice/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @model ErrorViewModel
2 | @{
3 | ViewData["Title"] = "Error";
4 | }
5 |
6 | Error.
7 | An error occurred while processing your request.
8 |
9 | @if (Model.ShowRequestId)
10 | {
11 |
12 | Request ID: @Model.RequestId
13 |
14 | }
15 |
16 | Development Mode
17 |
18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | The Development environment shouldn't be enabled for deployed applications.
22 | It can result in displaying sensitive information from exceptions to end users.
23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
24 | and restarting the app.
25 |
26 |
--------------------------------------------------------------------------------
/Spice/Spice.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 | aspnet-Spice-9463C74A-79FC-4526-9904-1C4FE19F212B
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Spice/Areas/Admin/Views/Category/Create.cshtml:
--------------------------------------------------------------------------------
1 | @model Category
2 |
3 | @{
4 | ViewData["Title"] = "Create";
5 | Layout = "~/Views/Shared/_Layout.cshtml";
6 | }
7 |
8 |
9 | Create Category
10 |
11 |
12 |
32 |
33 | @section Scripts
34 | {
35 | @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
36 | }
37 |
--------------------------------------------------------------------------------
/Spice/Areas/Admin/Views/Category/Edit.cshtml:
--------------------------------------------------------------------------------
1 | @model Spice.Models.Category
2 |
3 | @{
4 | ViewData["Title"] = "Edit";
5 | Layout = "~/Views/Shared/_Layout.cshtml";
6 | }
7 |
8 |
9 | Edit Category
10 |
11 |
12 |
32 |
33 | @section Scripts
34 | {
35 | @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
36 | }
--------------------------------------------------------------------------------
/Spice/Areas/Customer/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using Microsoft.AspNetCore.Mvc;
3 | using Microsoft.Extensions.Logging;
4 | using Spice.Models;
5 |
6 | namespace Spice.Controllers
7 | {
8 | [Area("Customer")]
9 | public class HomeController : Controller
10 | {
11 | private readonly ILogger _logger;
12 |
13 | public HomeController(ILogger logger)
14 | {
15 | _logger = logger;
16 | }
17 |
18 | public IActionResult Index()
19 | {
20 | return View();
21 | }
22 |
23 | public IActionResult Privacy()
24 | {
25 | return View();
26 | }
27 |
28 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
29 | public IActionResult Error()
30 | {
31 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/Manage/PersonalData.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model PersonalDataModel
3 | @{
4 | ViewData["Title"] = "Personal Data";
5 | ViewData["ActivePage"] = ManageNavPages.PersonalData;
6 | }
7 |
8 | @ViewData["Title"]
9 |
10 |
11 |
12 |
Your account contains personal data that you have given us. This page allows you to download or delete that data.
13 |
14 | Deleting this data will permanently remove your account, and this cannot be recovered.
15 |
16 |
19 |
20 | Delete
21 |
22 |
23 |
24 |
25 | @section Scripts {
26 |
27 | }
--------------------------------------------------------------------------------
/Spice/Data/Migrations/20200907162344_AddCategoryToDb.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.EntityFrameworkCore.Migrations;
2 |
3 | namespace Spice.Data.Migrations
4 | {
5 | public partial class AddCategoryToDb : Migration
6 | {
7 | protected override void Up(MigrationBuilder migrationBuilder)
8 | {
9 | migrationBuilder.CreateTable(
10 | name: "Category",
11 | columns: table => new
12 | {
13 | Id = table.Column(nullable: false)
14 | .Annotation("SqlServer:Identity", "1, 1"),
15 | Name = table.Column(nullable: false)
16 | },
17 | constraints: table =>
18 | {
19 | table.PrimaryKey("PK_Category", x => x.Id);
20 | });
21 | }
22 |
23 | protected override void Down(MigrationBuilder migrationBuilder)
24 | {
25 | migrationBuilder.DropTable(
26 | name: "Category");
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Spice/Views/Shared/_LoginPartial.cshtml:
--------------------------------------------------------------------------------
1 | @using Microsoft.AspNetCore.Identity
2 | @inject SignInManager SignInManager
3 | @inject UserManager UserManager
4 |
5 |
27 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/Manage/ResetAuthenticator.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ResetAuthenticatorModel
3 | @{
4 | ViewData["Title"] = "Reset authenticator key";
5 | ViewData["ActivePage"] = ManageNavPages.TwoFactorAuthentication;
6 | }
7 |
8 |
9 | @ViewData["Title"]
10 |
11 |
12 |
13 | If you reset your authenticator key your authenticator app will not work until you reconfigure it.
14 |
15 |
16 | This process disables 2FA until you verify your authenticator app.
17 | If you do not complete your authenticator app configuration you may lose access to your account.
18 |
19 |
20 |
21 |
24 |
--------------------------------------------------------------------------------
/Spice/Areas/Admin/Views/Category/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable
2 |
3 | @{
4 | ViewData["Title"] = "Category";
5 | Layout = "~/Views/Shared/_Layout.cshtml";
6 | }
7 |
8 |
9 |
10 |
11 |
12 |
Category List
13 |
14 |
17 |
18 |
19 |
20 | @if (Model.Any())
21 | {
22 |
23 |
24 | |
25 | @Html.DisplayNameFor(m => m.Name)
26 | |
27 | |
28 | |
29 |
30 | @foreach (var item in Model)
31 | {
32 |
33 | |
34 | @item.Name
35 | |
36 |
37 |
38 | |
39 |
40 | }
41 |
42 | }
43 | else
44 | {
45 |
No category exists...
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model LoginWithRecoveryCodeModel
3 | @{
4 | ViewData["Title"] = "Recovery code verification";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
10 | You have requested to log in with a recovery code. This login will not be remembered until you provide
11 | an authenticator app code at log in or disable 2FA and log in again.
12 |
13 |
26 |
27 | @section Scripts {
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/Manage/PersonalData.cshtml.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Microsoft.AspNetCore.Identity;
3 | using Microsoft.AspNetCore.Mvc;
4 | using Microsoft.AspNetCore.Mvc.RazorPages;
5 | using Microsoft.Extensions.Logging;
6 |
7 | namespace Spice.Areas.Identity.Pages.Account.Manage
8 | {
9 | public class PersonalDataModel : PageModel
10 | {
11 | private readonly UserManager _userManager;
12 | private readonly ILogger _logger;
13 |
14 | public PersonalDataModel(
15 | UserManager userManager,
16 | ILogger logger)
17 | {
18 | _userManager = userManager;
19 | _logger = logger;
20 | }
21 |
22 | public async Task OnGet()
23 | {
24 | var user = await _userManager.GetUserAsync(User);
25 | if (user == null)
26 | {
27 | return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
28 | }
29 |
30 | return Page();
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/Manage/GenerateRecoveryCodes.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model GenerateRecoveryCodesModel
3 | @{
4 | ViewData["Title"] = "Generate two-factor authentication (2FA) recovery codes";
5 | ViewData["ActivePage"] = ManageNavPages.TwoFactorAuthentication;
6 | }
7 |
8 |
9 | @ViewData["Title"]
10 |
11 |
12 |
13 | Put these codes in a safe place.
14 |
15 |
16 | If you lose your device and don't have the recovery codes you will lose access to your account.
17 |
18 |
19 | Generating new recovery codes does not change the keys used in authenticator apps. If you wish to change the key
20 | used in an authenticator app you should reset your authenticator keys.
21 |
22 |
23 |
24 |
27 |
--------------------------------------------------------------------------------
/Spice.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30413.136
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spice", "Spice\Spice.csproj", "{E2294BDC-B2ED-4468-922B-0C1F0A13BC4B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {E2294BDC-B2ED-4468-922B-0C1F0A13BC4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {E2294BDC-B2ED-4468-922B-0C1F0A13BC4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {E2294BDC-B2ED-4468-922B-0C1F0A13BC4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {E2294BDC-B2ED-4468-922B-0C1F0A13BC4B}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {6695F05C-0EEF-4406-B9D8-D4E4ED029CC5}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model DeletePersonalDataModel
3 | @{
4 | ViewData["Title"] = "Delete Personal Data";
5 | ViewData["ActivePage"] = ManageNavPages.PersonalData;
6 | }
7 |
8 | @ViewData["Title"]
9 |
10 |
11 |
12 | Deleting this data will permanently remove your account, and this cannot be recovered.
13 |
14 |
15 |
16 |
30 |
31 | @section Scripts {
32 |
33 | }
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/Manage/Index.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model IndexModel
3 | @{
4 | ViewData["Title"] = "Profile";
5 | ViewData["ActivePage"] = ManageNavPages.Index;
6 | }
7 |
8 | @ViewData["Title"]
9 |
10 |
27 |
28 | @section Scripts {
29 |
30 | }
--------------------------------------------------------------------------------
/Spice/wwwroot/lib/jquery-validation/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | =====================
3 |
4 | Copyright Jörn Zaefferer
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/Spice/Models/MenuItem.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 | using System.ComponentModel.DataAnnotations.Schema;
3 |
4 | namespace Spice.Models
5 | {
6 | public class MenuItem
7 | {
8 | [Key]
9 | public int Id { get; set; }
10 |
11 | [Required]
12 | public string Name { get; set; }
13 | public string Description { get; set; }
14 | public string Spiciness { get; set; }
15 | public string Image { get; set; }
16 |
17 | [Display(Name="Category")]
18 | public int CategoryId { get; set; }
19 |
20 | [ForeignKey("CategoryId")]
21 | public virtual Category Category { get; set; }
22 |
23 | [Display(Name = "SubCategory")]
24 | public int SubCategoryId { get; set; }
25 |
26 | [ForeignKey("SubCategoryId")]
27 | public virtual SubCategory SubCategory { get; set; }
28 |
29 | [Range(1, int.MaxValue, ErrorMessage = "Price should be greater than 1$")]
30 | public double Price { get; set; }
31 |
32 | public enum ESpicy
33 | {
34 | NA = 0,
35 | NotSpicy = 1,
36 | Spicy = 2,
37 | VerySpicy = 3
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Spice/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2018 Twitter, Inc.
4 | Copyright (c) 2011-2018 The Bootstrap Authors
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/Spice/Areas/Admin/Views/SubCategory/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable
2 |
3 | @{
4 | ViewData["Title"] = "Category";
5 | Layout = "~/Views/Shared/_Layout.cshtml";
6 | }
7 |
8 |
9 |
10 |
11 |
12 |
SubCategory List
13 |
14 |
17 |
18 |
19 |
20 | @if (Model.Any())
21 | {
22 |
23 |
24 | |
25 | @Html.DisplayNameFor(m => m.Name)
26 | |
27 |
28 | @Html.DisplayNameFor(m => m.Category.Name)
29 | |
30 | |
31 | |
32 |
33 | @foreach (var item in Model)
34 | {
35 |
36 | |
37 | @item.Name
38 | |
39 |
40 | @item.Category.Name
41 | |
42 |
43 |
44 | |
45 |
46 | }
47 |
48 | }
49 | else
50 | {
51 |
No Sub Category exists...
52 | }
53 |
54 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/ExternalLogin.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ExternalLoginModel
3 | @{
4 | ViewData["Title"] = "Register";
5 | }
6 |
7 | @ViewData["Title"]
8 | Associate your @Model.ProviderDisplayName account.
9 |
10 |
11 |
12 | You've successfully authenticated with @Model.ProviderDisplayName.
13 | Please enter an email address for this site below and click the Register button to finish
14 | logging in.
15 |
16 |
17 |
30 |
31 | @section Scripts {
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/Manage/_ManageNav.cshtml:
--------------------------------------------------------------------------------
1 | @inject SignInManager SignInManager
2 | @{
3 | var hasExternalLogins = (await SignInManager.GetExternalAuthenticationSchemesAsync()).Any();
4 | }
5 |
16 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/Logout.cshtml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Authorization;
6 | using Microsoft.AspNetCore.Identity;
7 | using Microsoft.AspNetCore.Mvc;
8 | using Microsoft.AspNetCore.Mvc.RazorPages;
9 | using Microsoft.Extensions.Logging;
10 |
11 | namespace Spice.Areas.Identity.Pages.Account
12 | {
13 | [AllowAnonymous]
14 | public class LogoutModel : PageModel
15 | {
16 | private readonly SignInManager _signInManager;
17 | private readonly ILogger _logger;
18 |
19 | public LogoutModel(SignInManager signInManager, ILogger logger)
20 | {
21 | _signInManager = signInManager;
22 | _logger = logger;
23 | }
24 |
25 | public void OnGet()
26 | {
27 | }
28 |
29 | public async Task OnPost(string returnUrl = null)
30 | {
31 | await _signInManager.SignOutAsync();
32 | _logger.LogInformation("User logged out.");
33 | if (returnUrl != null)
34 | {
35 | return LocalRedirect(returnUrl);
36 | }
37 | else
38 | {
39 | return RedirectToPage();
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Spice/Areas/Identity/Pages/Account/Manage/SetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model SetPasswordModel
3 | @{
4 | ViewData["Title"] = "Set password";
5 | ViewData["ActivePage"] = ManageNavPages.ChangePassword;
6 | }
7 |
8 | Set your password
9 |
10 |
11 | You do not have a local username/password for this site. Add a local
12 | account so you can log in without an external login.
13 |
14 |
32 |
33 | @section Scripts {
34 |
35 | }
--------------------------------------------------------------------------------
/Spice/Areas/Admin/Views/MenuItem/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable