Certificate proving catch of criminal
12 |13 |
To {0}
14 |15 |
Date of issue: {1}
16 | Date of submission {2}
17 | This certificate proves catch of criminal named :
18 | {4} this criminal was escorted to {3}
19 | police department. In the name of Interpol we are kindly thanking you
20 | for your contribution.
21 |
22 |
23 | Thank you
24 |
Admiral of Interpoll
25 |
Tarim Abzhal
26 |
27 |
28 | ";
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/InterpolSystem.Test/InterpolSystem.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/InterpolSystem.Test/Mocks/RoleManagerMock.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Test.Mocks
2 | {
3 | using Microsoft.AspNetCore.Identity;
4 | using Moq;
5 |
6 | public class RoleManagerMock
7 | {
8 | public static Mock> New
9 | => new Mock>(
10 | Mock.Of>(), null, null, null, null);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/InterpolSystem.Test/Mocks/TestServerFixture.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Test.Mocks
2 | {
3 | using InterpolSystem.Web;
4 | using Microsoft.AspNetCore.Hosting;
5 | using Microsoft.AspNetCore.TestHost;
6 | using Microsoft.Extensions.PlatformAbstractions;
7 | using System;
8 | using System.IO;
9 | using System.Net.Http;
10 |
11 | public class TestServerFixture : IDisposable
12 | {
13 | // private const string BaseUri = "https://localhost:4368/";
14 | private readonly TestServer testServer;
15 |
16 | public TestServerFixture()
17 | {
18 | var builder = new WebHostBuilder()
19 | //.UseContentRoot(GetContentRootPath())
20 | .UseStartup();
21 |
22 | testServer = new TestServer(builder);
23 | Client = testServer.CreateClient();
24 | //this.Client.BaseAddress = new Uri(BaseUri);
25 | }
26 |
27 | public HttpClient Client { get; }
28 |
29 | public void Dispose()
30 | {
31 | this.Client?.Dispose();
32 | testServer?.Dispose();
33 | }
34 |
35 | //private string GetContentRootPath()
36 | //{
37 | // var testProjectPath = PlatformServices.Default.Application.ApplicationBasePath;
38 | // var relativePathToHostProject = "../../../../InterpolSystem.Web";
39 | // return Path.Combine(testProjectPath, relativePathToHostProject);
40 | //}
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/InterpolSystem.Test/Mocks/UserManagerMock.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Test.Mocks
2 | {
3 | using InterpolSystem.Data.Models;
4 | using Microsoft.AspNetCore.Identity;
5 | using Moq;
6 |
7 | public class UserManagerMock
8 | {
9 | public static Mock> New
10 | => new Mock>(
11 | Mock.Of>(), null, null, null, null, null, null, null, null);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/InterpolSystem.Test/Tests.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Test
2 | {
3 | using AutoMapper;
4 | using InterpolSystem.Common.Mapping;
5 | using InterpolSystem.Data;
6 | using Microsoft.EntityFrameworkCore;
7 | using System;
8 |
9 | public class Tests
10 | {
11 | private static bool testsInitialized = false;
12 |
13 | public static void InitializeAutoMapper()
14 | {
15 | if (!testsInitialized)
16 | {
17 | Mapper.Initialize(config => config.AddProfile());
18 | testsInitialized = true;
19 | }
20 | }
21 |
22 | public static InterpolDbContext GetDatabase()
23 | {
24 | var dbOptions = new DbContextOptionsBuilder()
25 | .UseInMemoryDatabase(Guid.NewGuid().ToString())
26 | .Options; // create everytime unique name cuz if the name is equal to all methods it will share the database between them
27 |
28 | return new InterpolDbContext(dbOptions);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/InterpolSystem.Test/Web/Areas/Admin/Controllers/LoggerControllerTest.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Test.Web.Areas.Admin.Controllers
2 | {
3 | using FluentAssertions;
4 | using InterpolSystem.Services.Admin;
5 | using InterpolSystem.Services.Admin.Implementations;
6 | using InterpolSystem.Web.Areas.Admin.Controllers;
7 | using InterpolSystem.Web.Areas.Admin.Models.Logger;
8 | using Microsoft.AspNetCore.Authorization;
9 | using Microsoft.AspNetCore.Mvc;
10 | using Moq;
11 | using System.Linq;
12 | using Xunit;
13 |
14 | using static InterpolSystem.Web.WebConstants;
15 |
16 | public class LoggerControllerTest
17 | {
18 | public LoggerControllerTest()
19 | {
20 | Tests.InitializeAutoMapper();
21 | }
22 |
23 | [Fact]
24 | public void LogerControllerShouldBeInAdminArea()
25 | {
26 | // Arrange
27 | var controller = typeof(LoggerController);
28 |
29 | // Act
30 | var areaAttribute = controller
31 | .GetCustomAttributes(true)
32 | .FirstOrDefault(attr => attr.GetType() == typeof(AreaAttribute))
33 | as AreaAttribute;
34 |
35 | // Assert
36 | areaAttribute
37 | .Should()
38 | .NotBeNull();
39 |
40 | areaAttribute.RouteValue
41 | .Should()
42 | .Be(AdminArea);
43 | }
44 |
45 | [Fact]
46 | public void LoggerControllerShouldBeOnlyForAdmins()
47 | {
48 | // Arrange
49 | var controller = typeof(LoggerController);
50 |
51 | // Act
52 | var authorizeAttribute = controller
53 | .GetCustomAttributes(true)
54 | .FirstOrDefault(attr => attr.GetType() == typeof(AuthorizeAttribute))
55 | as AuthorizeAttribute;
56 |
57 | // Assert
58 | authorizeAttribute
59 | .Should()
60 | .NotBeNull();
61 |
62 | authorizeAttribute.Roles
63 | .Should()
64 | .Be(AdministratorRole);
65 | }
66 |
67 | [Fact]
68 | public void ShouldReturnTheCorrectViewModel()
69 | {
70 | // Arrange
71 | var loggerService = new Mock().Object;
72 | var controller = new LoggerController(loggerService);
73 |
74 | // Act
75 | var result = controller.All(string.Empty) as ViewResult;
76 |
77 | // Assert
78 | result
79 | .Should()
80 | .NotBeNull();
81 |
82 | var model = result.As().Model;
83 |
84 | model
85 | .Should()
86 | .BeOfType();
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/InterpolSystem.Test/Web/Controllers/MissingPeopleControllerIntegrationTests.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Test.Web.Controllers
2 | {
3 | using InterpolSystem.Test.Mocks;
4 | using System.Threading.Tasks;
5 | using Xunit;
6 |
7 | public class MissingPeopleControllerIntegrationTests : IClassFixture
8 | {
9 | private readonly TestServerFixture server;
10 |
11 | public MissingPeopleControllerIntegrationTests(TestServerFixture server)
12 | {
13 | this.server = server;
14 | }
15 | // TODO SERVER CANNOT FIND FOLDERS
16 | //[Fact]
17 | //public async Task IndexPageShouldReturnStatusCode200()
18 | //{
19 | // var client = this.server.Client;
20 | // var response = await client.GetAsync("/");
21 |
22 | // response.EnsureSuccessStatusCode();
23 | //}
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "wwwroot/lib"
3 | }
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Admin/Controllers/BaseAdminController.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Areas.Admin.Controllers
2 | {
3 | using Microsoft.AspNetCore.Authorization;
4 | using Microsoft.AspNetCore.Mvc;
5 |
6 | using static WebConstants;
7 |
8 | [Area(AdminArea)]
9 | [Authorize(Roles = AdministratorRole)]
10 | public abstract class BaseAdminController : Controller
11 | {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Admin/Controllers/LoggerController.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Areas.Admin.Controllers
2 | {
3 | using Microsoft.AspNetCore.Mvc;
4 | using Models.Logger;
5 | using Services.Admin;
6 | using System;
7 | using System.Linq;
8 |
9 | public class LoggerController : BaseAdminController
10 | {
11 | private const int ValuesPerPage = 7;
12 | private readonly ILoggerService loggerService;
13 | private int currentPageSize = ValuesPerPage;
14 |
15 | public LoggerController(ILoggerService loggerService)
16 | {
17 | this.loggerService = loggerService;
18 | }
19 |
20 | public IActionResult All(string search, int page = 1)
21 | {
22 | var logs = this.loggerService.All();
23 |
24 | if (!string.IsNullOrWhiteSpace(search))
25 | {
26 | logs = logs.Where(l => l.Username.ToLower().Contains(search.ToLower()));
27 | this.currentPageSize = logs.Count();
28 | }
29 |
30 | if (page < 1)
31 | {
32 | page = 1;
33 | }
34 |
35 | logs = logs
36 | .Skip((page - 1) * ValuesPerPage)
37 | .Take(ValuesPerPage);
38 |
39 | return View(new LoggerPagingViewModel
40 | {
41 | Logs = logs,
42 | Search = search,
43 | CurrentPage = page,
44 | TotalPages = (int)Math.Ceiling(this.loggerService.Total() / (double)currentPageSize)
45 | });
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Admin/Models/Logger/LoggerPagingViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Areas.Admin.Models.Logger
2 | {
3 | using Services.Admin.Models;
4 | using System.Collections.Generic;
5 |
6 | public class LoggerPagingViewModel
7 | {
8 | public IEnumerable Logs { get; set; }
9 |
10 | public string Search { get; set; }
11 |
12 | public int TotalPages { get; set; }
13 |
14 | public int CurrentPage { get; set; }
15 |
16 | public int PreviousPage => this.CurrentPage == 1 ? 1 : this.CurrentPage - 1;
17 |
18 | public int NextPage => this.CurrentPage == this.TotalPages ? this.TotalPages : this.CurrentPage + 1;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Admin/Models/Users/AddRemoveUserToRoleViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Areas.Admin.Models.Users
2 | {
3 | using System.ComponentModel.DataAnnotations;
4 |
5 | public class AddRemoveUserToRoleViewModel
6 | {
7 | [Required]
8 | public string UserId { get; set; }
9 |
10 | [Required]
11 | public string Role { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Admin/Models/Users/CreateUserFormViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Areas.Admin.Models.Users
2 | {
3 | using System.ComponentModel.DataAnnotations;
4 |
5 | using static Data.DataConstants;
6 |
7 | public class CreateUserFormViewModel : UserRolesViewModel
8 | {
9 | [Required]
10 | [MaxLength(UserNamesMaxLength)]
11 | [MinLength(UserNamesMinLength, ErrorMessage = "Username must be at least 2 symbols long.")]
12 | [Display(Name = "Username")]
13 | public string UserName { get; set; }
14 |
15 | [Required]
16 | [EmailAddress]
17 | [Display(Name = "Email")]
18 | public string Email { get; set; }
19 |
20 | [Required]
21 | [MaxLength(UserNamesMaxLength)]
22 | [MinLength(UserNamesMinLength, ErrorMessage = "First name must be at least 2 symbols long.")]
23 | [Display(Name = "First name")]
24 | public string FirstName { get; set; }
25 |
26 | [Required]
27 | [MaxLength(UserNamesMaxLength)]
28 | [MinLength(UserNamesMinLength, ErrorMessage = "Last name must be at least 2 symbols long.")]
29 | [Display(Name = "Last name")]
30 | public string LastName { get; set; }
31 |
32 | [Required]
33 | [Display(Name = "Without role")]
34 | public bool WithoutRole { get; set; }
35 |
36 | public string Role { get; set; }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Admin/Models/Users/UserListingsViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Areas.Admin.Models.Users
2 | {
3 | using Services.Admin.Models;
4 | using System.Collections.Generic;
5 |
6 | public class UserListingsViewModel : UserRolesViewModel
7 | {
8 | public IEnumerable Users { get; set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Admin/Models/Users/UserRolesViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Areas.Admin.Models.Users
2 | {
3 | using Microsoft.AspNetCore.Mvc.Rendering;
4 | using System.Collections.Generic;
5 |
6 | public class UserRolesViewModel
7 | {
8 | public IEnumerable Roles { get; set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Admin/Views/Users/Create.cshtml:
--------------------------------------------------------------------------------
1 | @model CreateUserFormViewModel
2 |
3 | @{
4 | ViewData["Title"] = "Create user";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
10 |
11 |
44 |
45 |
46 |
47 | @section Scripts {
48 | @await Html.PartialAsync("_ValidationScriptsPartial")
49 | }
50 |
51 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Admin/Views/Users/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model UserListingsViewModel
2 |
3 | @{
4 | ViewData["Title"] = "User Administration";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
10 |
11 |
12 | Username
13 | Email
14 | Roles
15 | Manage Roles
16 | User options
17 |
18 |
19 |
20 | @foreach (var user in Model.Users)
21 | {
22 |
23 | @user.Username
24 | @user.Email
25 |
26 | @if (user.RoleNames.Any())
27 | {
28 | @string.Join(", ", user.RoleNames)
29 | }
30 | else
31 | {
32 | Does not have any roles.
33 | }
34 |
35 |
36 |
48 |
49 |
50 |
59 |
60 |
61 | }
62 |
63 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Admin/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using InterpolSystem.Web.Areas.Admin.Models.Users
2 | @using InterpolSystem.Web.Areas.Admin.Models.Logger
3 | @using InterpolSystem.Web.Areas.Admin.Controllers
4 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
5 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Admin/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Blog/Controllers/ArticlesController.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Areas.Blog.Controllers
2 | {
3 | using Data.Models;
4 | using Infrastructure.Extensions;
5 | using Microsoft.AspNetCore.Authorization;
6 | using Microsoft.AspNetCore.Identity;
7 | using Microsoft.AspNetCore.Mvc;
8 | using Models.Articles;
9 | using Services.Blog;
10 | using Services.Html;
11 | using System;
12 |
13 | using static WebConstants;
14 |
15 | [Area(BlogArea)]
16 | [Authorize(Roles = BloggerRole)]
17 | public class ArticlesController : Controller
18 | {
19 | private readonly IArticleService articleService;
20 | private readonly UserManager userManager;
21 | private readonly IHtmlService htmlService;
22 |
23 | public ArticlesController(
24 | IArticleService articleService,
25 | UserManager userManager,
26 | IHtmlService htmlService)
27 |
28 | {
29 | this.articleService = articleService;
30 | this.userManager = userManager;
31 | this.htmlService = htmlService;
32 | }
33 |
34 | [AllowAnonymous]
35 | public IActionResult Index()
36 | => View(this.articleService.All());
37 |
38 | [AllowAnonymous]
39 | public IActionResult Details(int id)
40 | => this.ViewOrNotFound(this.articleService.ById(id));
41 |
42 | public IActionResult Create() => View();
43 |
44 | [HttpPost]
45 | public IActionResult Create(PublishArticleFormViewModel model)
46 | {
47 | var userId = this.userManager.GetUserId(this.User);
48 |
49 | if (userId == null)
50 | {
51 | TempData.AddErrorMessage("The author does not exist.");
52 | return View();
53 | }
54 |
55 | var sanitizedContent = this.htmlService.Sanitize(model.Content);
56 |
57 | try
58 | {
59 | this.articleService.Create(model.Title, sanitizedContent, userId);
60 | }
61 | catch (InvalidOperationException ex)
62 | {
63 | return BadRequest(ex.Message);
64 | }
65 | catch (Exception ex)
66 | {
67 | return BadRequest(ex.Message);
68 | }
69 |
70 | TempData.AddSuccessMessage("Successfully published.");
71 |
72 | return RedirectToAction(nameof(Index));
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Blog/Models/Articles/PublishArticleFormViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Areas.Blog.Models.Articles
2 | {
3 | using System.ComponentModel.DataAnnotations;
4 |
5 | using static Data.DataConstants;
6 |
7 | public class PublishArticleFormViewModel
8 | {
9 | [Required]
10 | [StringLength(ArticlesTitleMaxLength, MinimumLength = ArticlesTitleMinLength)]
11 | public string Title { get; set; }
12 |
13 | [Required]
14 | [StringLength(ArticlesContentMaxLength, MinimumLength = ArticlesContentMinLength)]
15 | public string Content { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Blog/Views/Articles/Create.cshtml:
--------------------------------------------------------------------------------
1 | @model PublishArticleFormViewModel
2 |
3 | @{
4 | ViewData["Title"] = "Publish Article";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
10 |
22 |
23 |
24 |
25 |
38 |
39 |
40 |
41 | @section Scripts {
42 | @await Html.PartialAsync("_ValidationScriptsPartial")
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Blog/Views/Articles/Details.cshtml:
--------------------------------------------------------------------------------
1 | @model ArticlesDetailsServiceModel
2 |
3 | @{
4 | ViewData["Title"] = Model.Title;
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 | Published by @Model.AuthorName on @Model.PublishDate.ToLocalTime()
10 |
11 | @Html.Raw(Model.Content)
12 |
13 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Blog/Views/Articles/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable
2 |
3 | @{
4 | ViewData["Title"] = "News";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
10 | @await Html.PartialAsync("_AllArticlesPartial.cshtml", Model)
11 |
12 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Blog/Views/Articles/_AllArticlesPartial.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable
2 |
3 |
4 | @foreach (var article in Model)
5 | {
6 | -
7 |
8 | @article.Title
9 |
10 |
11 | published by @article.AuthorName on @article.PublishDate.ToLocalTime()
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Blog/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using InterpolSystem.Services.Blog.Models
2 | @using InterpolSystem.Web.Areas.Blog.Models.Articles
3 | @using InterpolSystem.Web.Infrastructure.Extensions
4 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
5 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/Blog/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyAdmin/Controllers/BaseBountyAdminController.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Areas.BountyAdmin.Controllers
2 | {
3 | using Microsoft.AspNetCore.Authorization;
4 | using Microsoft.AspNetCore.Mvc;
5 | using Microsoft.AspNetCore.Mvc.Rendering;
6 | using Services.BountyAdmin;
7 | using System.Collections.Generic;
8 | using System.Linq;
9 |
10 | using static WebConstants;
11 |
12 | [Area(BountyAdminArea)]
13 | [Authorize(Roles = WantedMissingPeopleRole + ", " + AdministratorRole)]
14 | public abstract class BaseBountyAdminController : Controller
15 | {
16 | protected readonly IBountyAdminService bountyAdminService;
17 |
18 | protected BaseBountyAdminController(IBountyAdminService bountyAdminService)
19 | {
20 | this.bountyAdminService = bountyAdminService;
21 | }
22 |
23 | protected List GetLanguages()
24 | => this.bountyAdminService.GetLanguagesList()
25 | .Select(r => new SelectListItem
26 | {
27 | Text = r.Name,
28 | Value = r.Id.ToString()
29 | })
30 | .ToList();
31 |
32 | protected List GetCountries()
33 | => this.bountyAdminService.GetCountriesList()
34 | .Select(r => new SelectListItem
35 | {
36 | Text = r.Name,
37 | Value = r.Id.ToString()
38 | })
39 | .ToList();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyAdmin/Models/LanguageAndCountryListingsViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Areas.BountyAdmin.Models
2 | {
3 | using Microsoft.AspNetCore.Mvc.Rendering;
4 | using System.Collections.Generic;
5 | using System.ComponentModel.DataAnnotations;
6 |
7 | public class LanguageAndCountryListingsViewModel
8 | {
9 | [Display(Name = "Spoken languages")]
10 | public IEnumerable Languages { get; set; }
11 |
12 | public IEnumerable SelectedLanguages { get; set; }
13 |
14 | [Display(Name = "Given nationalities")]
15 | public IEnumerable Countries { get; set; }
16 |
17 | public IEnumerable SelectedCountries { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyAdmin/Models/WantedPeople/ChargeViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Areas.BountyAdmin.Models.WantedPeople
2 | {
3 | using Microsoft.AspNetCore.Mvc.Rendering;
4 | using System.Collections.Generic;
5 | using System.ComponentModel.DataAnnotations;
6 |
7 | using static Data.DataConstants;
8 |
9 | public class ChargeViewModel
10 | {
11 | public int WantedPersonId { get; set; }
12 |
13 | [Required]
14 | [MaxLength(ChargesDescriptionMaxLength)]
15 | [MinLength(ChargesDescriptionMinLength)]
16 | [Display(Name = "Charge description")]
17 | public string Description { get; set; }
18 |
19 | [Display(Name = "Accused in countries:")]
20 | public IEnumerable Countries { get; set; }
21 |
22 | public IEnumerable SelectedCountries { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyAdmin/Models/WantedPeople/WantedFilteredFormViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Areas.BountyAdmin.Models.WantedPeople
2 | {
3 | using Services.BountyAdmin.Models;
4 | using System.Collections.Generic;
5 |
6 | public class WantedFilteredFormViewModel
7 | {
8 | public int Type { get; set; }
9 |
10 | public IEnumerable Forms { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyAdmin/Views/MissingPeople/Create.cshtml:
--------------------------------------------------------------------------------
1 | @model MissingPeopleFormViewModel
2 |
3 | @{
4 | ViewData["Title"] = "Add missing person";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
10 |
11 | @await Html.PartialAsync("_MissingPeopleForm", Model)
12 |
13 |
14 |
15 | @section Scripts {
16 | @await Html.PartialAsync("_ValidationScriptsPartial")
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyAdmin/Views/MissingPeople/Edit.cshtml:
--------------------------------------------------------------------------------
1 | @model MissingPeopleFormViewModel
2 |
3 | @{
4 | ViewData["Title"] = "Edit person";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
10 |
11 | @Html.Partial("_MissingPeopleForm", Model)
12 |
13 |
14 |
15 | @section Scripts {
16 | @await Html.PartialAsync("_ValidationScriptsPartial")
17 | }
18 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyAdmin/Views/WantedPeople/AddCharge.cshtml:
--------------------------------------------------------------------------------
1 | @model ChargeViewModel
2 |
3 | @{
4 | ViewData["Title"] = "Add Charge";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
41 |
42 |
43 | View details
44 |
45 |
46 | @section Scripts {
47 | @await Html.PartialAsync("_ValidationScriptsPartial")
48 | }
49 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyAdmin/Views/WantedPeople/Create.cshtml:
--------------------------------------------------------------------------------
1 | @model WantedPeopleFormViewModel
2 |
3 | @{
4 | ViewData["Title"] = "Add Wanted Person";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
10 |
11 | @await Html.PartialAsync("_WantedPeopleForm", Model)
12 |
13 |
14 |
15 | @section Scripts {
16 | @await Html.PartialAsync("_ValidationScriptsPartial")
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyAdmin/Views/WantedPeople/Edit.cshtml:
--------------------------------------------------------------------------------
1 | @model WantedPeopleFormViewModel
2 |
3 | @{
4 | ViewData["Title"] = "Edit person";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
10 |
11 | @await Html.PartialAsync("_WantedPeopleForm", Model)
12 |
13 |
14 |
15 | @section Scripts {
16 | @await Html.PartialAsync("_ValidationScriptsPartial")
17 | }
18 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyAdmin/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using InterpolSystem.Data.Models.Enums
2 | @using InterpolSystem.Web.Areas.BountyAdmin.Models.MissingPeople
3 | @using InterpolSystem.Web.Areas.BountyAdmin.Models.WantedPeople
4 | @using InterpolSystem.Web.Infrastructure.Extensions
5 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
6 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyAdmin/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyHunter/Controllers/BountyHunterController.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Areas.BountyHunter.Controllers
2 | {
3 | using Data.Models;
4 | using Microsoft.AspNetCore.Authorization;
5 | using Microsoft.AspNetCore.Identity;
6 | using Microsoft.AspNetCore.Mvc;
7 | using Services.BountyHunter;
8 | using System.Threading.Tasks;
9 |
10 | using static WebConstants;
11 |
12 | [Area(BountyHunterArea)]
13 | [Authorize(Roles = BountyHunterRole)]
14 | public class BountyHunterController : Controller
15 | {
16 | private readonly IBountyHunterService hunterService;
17 | private readonly UserManager userManager;
18 |
19 | public BountyHunterController(
20 | IBountyHunterService hunterService,
21 | UserManager userManager)
22 | {
23 | this.hunterService = hunterService;
24 | this.userManager = userManager;
25 | }
26 |
27 | public IActionResult GetSubmittedForms()
28 | {
29 | var currentUserId = this.userManager.GetUserId(User);
30 |
31 | if (currentUserId == null)
32 | {
33 | return NotFound();
34 | }
35 |
36 | var forms = this.hunterService.GetSubmittedForms(currentUserId);
37 |
38 | return View(forms);
39 | }
40 |
41 | public async Task DownloadCertificate(int id)
42 | {
43 | var currentUser = await this.userManager.GetUserAsync(User);
44 |
45 | if (currentUser == null)
46 | {
47 | return NotFound();
48 | }
49 |
50 | var fullName = $"{currentUser.FirstName} {currentUser.LastName}";
51 |
52 | var certificateContent = this.hunterService.GetPdfCertificate(id, fullName, currentUser.Email);
53 |
54 | if (certificateContent == null)
55 | {
56 | return BadRequest();
57 | }
58 |
59 | return File(certificateContent, "application/pdf", "Official-Certificate.pdf");
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyHunter/Views/BountyHunter/GetSubmittedForms.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable
2 |
3 | @{
4 | ViewData["Title"] = "Submitted forms";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
10 |
11 |
12 | Date of submission
13 | Subject
14 | Message
15 | Police Department
16 | Status
17 |
18 |
19 |
20 | @foreach (var form in Model)
21 | {
22 |
23 | @form.SubmissionDate.ToLocalTime()
24 | @form.Subject
25 | @form.Message
26 | @form.PoliceDepartment
27 |
28 | @if (form.Status == FormOptions.Accepted)
29 | {
30 | Congrats! Take your certificate from
31 | here
32 | }
33 | else if (form.Status == FormOptions.Declined)
34 | {
35 | Your submission was declined.
36 | }
37 | else
38 | {
39 | Still waiting to be approved.
40 | }
41 |
42 |
43 | }
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyHunter/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using InterpolSystem.Services.BountyHunter.Models
2 | @using InterpolSystem.Data.Models.Enums
3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Areas/BountyHunter/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Controllers/BasePeopleController.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Controllers
2 | {
3 | using Microsoft.AspNetCore.Mvc;
4 | using Microsoft.AspNetCore.Mvc.Rendering;
5 | using Services.BountyAdmin;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 |
9 | public abstract class BasePeopleController : Controller
10 | {
11 | private readonly IBountyAdminService bountyAdminService;
12 |
13 | protected BasePeopleController(
14 | IBountyAdminService bountyAdminService)
15 | {
16 | this.bountyAdminService = bountyAdminService;
17 | }
18 |
19 | protected List GetCountries()
20 | => this.bountyAdminService.GetCountriesList()
21 | .Select(r => new SelectListItem
22 | {
23 | Text = r.Name,
24 | Value = r.Id.ToString()
25 | })
26 | .ToList();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Controllers
2 | {
3 | using Infrastructure.Filters;
4 | using Microsoft.AspNetCore.Mvc;
5 | using Models;
6 | using System.Diagnostics;
7 |
8 | public class HomeController : Controller
9 | {
10 | [SubmitForm]
11 | public IActionResult Index()
12 | {
13 | return View();
14 | }
15 |
16 | public IActionResult About()
17 | {
18 | ViewData["Message"] = "Your application description page.";
19 |
20 | return View();
21 | }
22 |
23 | public IActionResult Contact()
24 | {
25 | ViewData["Message"] = "Your contact page.";
26 |
27 | return View();
28 | }
29 |
30 | public IActionResult Error()
31 | {
32 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Controllers/MissingPeopleController.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Controllers
2 | {
3 | using Microsoft.AspNetCore.Mvc;
4 | using Models.MissingPeople;
5 | using Models.Shared;
6 | using Services;
7 | using Services.Blog;
8 | using Services.BountyAdmin;
9 | using System;
10 |
11 | using static WebConstants;
12 |
13 | public class MissingPeopleController : BasePeopleController
14 | {
15 | private readonly IArticleService articleService;
16 | private readonly IMissingPeopleService peopleService;
17 |
18 | public MissingPeopleController(
19 | IArticleService articleService,
20 | IMissingPeopleService peopleService,
21 | IBountyAdminService bountyAdminService)
22 | : base(bountyAdminService)
23 | {
24 | this.peopleService = peopleService;
25 | this.articleService = articleService;
26 | }
27 |
28 | public IActionResult Index(int page = 1)
29 | => View(new MissingPeoplePageListingModel
30 | {
31 | MissingPeople = this.peopleService.All(page, PageSize),
32 | CurrentPage = page,
33 | TotalPages = (int)Math.Ceiling(this.peopleService.Total() / (double)PageSize),
34 | Countries = this.GetCountries(),
35 | Articles = articleService.LastSixArticles()
36 | });
37 |
38 | public IActionResult Details(int id)
39 | {
40 | var existingPerson = this.peopleService.IsPersonExisting(id);
41 |
42 | if (!existingPerson)
43 | {
44 | return BadRequest();
45 | }
46 |
47 | var person = this.peopleService.GetPerson(id);
48 |
49 | return View(person);
50 | }
51 |
52 | public IActionResult Search(SearchFormViewModel model, int page = 1)
53 | => View(new MissingPeoplePageListingModel
54 | {
55 | CurrentPage = page,
56 | MissingPeople = this.peopleService.SearchByComponents(
57 | model.EnableCountrySearch,
58 | model.SelectedCountryId ?? 0,
59 | model.EnableGenderSearch,
60 | model.SelectedGender,
61 | model.SearchByFirstName,
62 | model.SearchByLastName,
63 | model.SearchByDistinguishMarks,
64 | model.SearchByAge ?? 0,
65 | page,
66 | PageSize),
67 | SearchCriteriaTotalPages = this.peopleService.SearchPeopleCriteriaCounter,
68 | TotalPages = (int)Math.Ceiling(this.peopleService.SearchPeopleCriteriaCounter / (double)PageSize),
69 | Articles = articleService.LastSixArticles()
70 | });
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Infrastructure/Extensions/ControllerExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Infrastructure.Extensions
2 | {
3 | using Microsoft.AspNetCore.Mvc;
4 |
5 | public static class ControllerExtensions
6 | {
7 | public static IActionResult ViewOrNotFound(this Controller controller, object model)
8 | {
9 | if (model == null)
10 | {
11 | return controller.NotFound();
12 | }
13 |
14 | return controller.View(model);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Infrastructure/Extensions/ServiceCollectionExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Infrastructure.Extensions
2 | {
3 | using Microsoft.Extensions.DependencyInjection;
4 | using Services;
5 | using System.Linq;
6 | using System.Reflection;
7 |
8 | public static class ServiceCollectionExtensions
9 | {
10 | public static IServiceCollection AddDomainServices(this IServiceCollection services)
11 | {
12 | Assembly
13 | .GetAssembly(typeof(IService))
14 | .GetTypes()
15 | .Where(t => t.IsClass && t.GetInterfaces().Any(i => i.Name == $"I{t.Name}"))
16 | .Select(t => new
17 | {
18 | Interface = t.GetInterface($"I{t.Name}"),
19 | Implementation = t
20 | })
21 | .ToList()
22 | .ForEach(s => services.AddTransient(s.Interface, s.Implementation));
23 |
24 | return services;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Infrastructure/Extensions/StringExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Infrastructure.Extensions
2 | {
3 | using System.Text.RegularExpressions;
4 |
5 | public static class StringExtensions
6 | {
7 | public static string ToFriendlyUrl(this string text)
8 | => Regex.Replace(text, @"[^A-Za-z0-9_\.~]+", "-").ToLower();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Infrastructure/Extensions/TempDataDictionaryExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Infrastructure.Extensions
2 | {
3 | using Microsoft.AspNetCore.Mvc.ViewFeatures;
4 |
5 | using static WebConstants;
6 |
7 | public static class TempDataDictionaryExtensions
8 | {
9 | public static void AddErrorMessage(this ITempDataDictionary tempData, string message)
10 | {
11 | tempData[TempDataErrorMessageKey] = message;
12 | }
13 |
14 | public static void AddSuccessMessage(this ITempDataDictionary tempData, string message)
15 | {
16 | tempData[TempDataSuccessMessageKey] = message;
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Infrastructure/Extensions/UrlHelperExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Microsoft.AspNetCore.Mvc
2 | {
3 | using InterpolSystem.Web.Controllers;
4 |
5 | public static class UrlHelperExtensions
6 | {
7 | public static string EmailConfirmationLink(this IUrlHelper urlHelper, string userId, string code, string scheme)
8 | {
9 | return urlHelper.Action(
10 | action: nameof(AccountController.ConfirmEmail),
11 | controller: "Account",
12 | values: new { userId, code },
13 | protocol: scheme);
14 | }
15 |
16 | public static string ResetPasswordCallbackLink(this IUrlHelper urlHelper, string userId, string code, string scheme)
17 | {
18 | return urlHelper.Action(
19 | action: nameof(AccountController.ResetPassword),
20 | controller: "Account",
21 | values: new { userId, code },
22 | protocol: scheme);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Infrastructure/Filters/SubmitFormAttribute.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Infrastructure.Filters
2 | {
3 | using Data;
4 | using Microsoft.AspNetCore.Mvc;
5 | using Microsoft.AspNetCore.Mvc.Filters;
6 | using Microsoft.Extensions.DependencyInjection;
7 | using System.Linq;
8 |
9 | using static WebConstants;
10 |
11 | public class SubmitFormAttribute : ActionFilterAttribute
12 | {
13 | public override void OnActionExecuting(ActionExecutingContext context)
14 | {
15 | if (!context.ModelState.IsValid)
16 | {
17 | return;
18 | }
19 |
20 | var db = context
21 | .HttpContext
22 | .RequestServices
23 | .GetService();
24 |
25 | var unreadedForms = db.SubmitForms
26 | .Where(f => f.Status == 0)
27 | .ToList();
28 |
29 | if (!unreadedForms.Any())
30 | {
31 | return;
32 | }
33 |
34 | var controller = context.Controller as Controller;
35 |
36 | if (controller == null)
37 | {
38 | return;
39 | }
40 |
41 | controller.ViewData[ValidForm] = unreadedForms.Count;
42 |
43 | base.OnActionExecuting(context);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/InterpolSystem.Web.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.0
5 | aspnet-InterpolSystem.Web-7D1A6485-134A-4964-B523-75B20C7B4790
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 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Account/ExternalLoginViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Account
2 | {
3 | using System.ComponentModel.DataAnnotations;
4 |
5 | public class ExternalLoginViewModel
6 | {
7 | [Required]
8 | [EmailAddress]
9 | public string Email { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Account/ForgotPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Account
2 | {
3 | using System.ComponentModel.DataAnnotations;
4 |
5 | public class ForgotPasswordViewModel
6 | {
7 | [Required]
8 | [EmailAddress]
9 | public string Email { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Account/LoginViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Account
2 | {
3 | using System.ComponentModel.DataAnnotations;
4 |
5 | using static Data.DataConstants;
6 |
7 | public class LoginViewModel
8 | {
9 | [Required]
10 | [MaxLength(UserNamesMaxLength)]
11 | [MinLength(UserNamesMinLength)]
12 | public string Username { get; set; }
13 |
14 | [Required]
15 | [DataType(DataType.Password)]
16 | public string Password { get; set; }
17 |
18 | [Display(Name = "Remember me?")]
19 | public bool RememberMe { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Account/LoginWith2faViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Account
2 | {
3 | using System.ComponentModel.DataAnnotations;
4 |
5 | public class LoginWith2faViewModel
6 | {
7 | [Required]
8 | [StringLength(7, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
9 | [DataType(DataType.Text)]
10 | [Display(Name = "Authenticator code")]
11 | public string TwoFactorCode { get; set; }
12 |
13 | [Display(Name = "Remember this machine")]
14 | public bool RememberMachine { get; set; }
15 |
16 | public bool RememberMe { get; set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Account/LoginWithRecoveryCodeViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Account
2 | {
3 | using System.ComponentModel.DataAnnotations;
4 |
5 | public class LoginWithRecoveryCodeViewModel
6 | {
7 | [Required]
8 | [DataType(DataType.Text)]
9 | [Display(Name = "Recovery Code")]
10 | public string RecoveryCode { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Account/RegisterViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Account
2 | {
3 | using System.ComponentModel.DataAnnotations;
4 |
5 | using static Data.DataConstants;
6 |
7 | public class RegisterViewModel
8 | {
9 | [Required]
10 | [MaxLength(UserNamesMaxLength)]
11 | [MinLength(UserNamesMinLength)]
12 | [Display(Name = "Username")]
13 | public string UserName { get; set; }
14 |
15 | [Required]
16 | [EmailAddress]
17 | [Display(Name = "Email")]
18 | public string Email { get; set; }
19 |
20 | [Required]
21 | [MaxLength(UserNamesMaxLength)]
22 | [MinLength(UserNamesMinLength)]
23 | [Display(Name = "First name")]
24 | public string FirstName { get; set; }
25 |
26 | [Required]
27 | [MaxLength(UserNamesMaxLength)]
28 | [MinLength(UserNamesMinLength)]
29 | [Display(Name = "Last name")]
30 | public string LastName { get; set; }
31 |
32 | [Required]
33 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
34 | [DataType(DataType.Password)]
35 | [Display(Name = "Password")]
36 | public string Password { get; set; }
37 |
38 | [DataType(DataType.Password)]
39 | [Display(Name = "Confirm password")]
40 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
41 | public string ConfirmPassword { get; set; }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Account/ResetPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Account
2 | {
3 | using System.ComponentModel.DataAnnotations;
4 |
5 | public class ResetPasswordViewModel
6 | {
7 | [Required]
8 | [EmailAddress]
9 | public string Email { get; set; }
10 |
11 | [Required]
12 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
13 | [DataType(DataType.Password)]
14 | public string Password { get; set; }
15 |
16 | [DataType(DataType.Password)]
17 | [Display(Name = "Confirm password")]
18 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
19 | public string ConfirmPassword { get; set; }
20 |
21 | public string Code { get; set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/ErrorViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models
2 | {
3 | public class ErrorViewModel
4 | {
5 | public string RequestId { get; set; }
6 |
7 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
8 | }
9 | }
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Manage/ChangePasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Manage
2 | {
3 | using System.ComponentModel.DataAnnotations;
4 |
5 | public class ChangePasswordViewModel
6 | {
7 | [Required]
8 | [DataType(DataType.Password)]
9 | [Display(Name = "Current password")]
10 | public string OldPassword { get; set; }
11 |
12 | [Required]
13 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
14 | [DataType(DataType.Password)]
15 | [Display(Name = "New password")]
16 | public string NewPassword { get; set; }
17 |
18 | [DataType(DataType.Password)]
19 | [Display(Name = "Confirm new password")]
20 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
21 | public string ConfirmPassword { get; set; }
22 |
23 | public string StatusMessage { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Manage/EnableAuthenticatorViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Manage
2 | {
3 | using Microsoft.AspNetCore.Mvc.ModelBinding;
4 | using System.ComponentModel.DataAnnotations;
5 |
6 | public class EnableAuthenticatorViewModel
7 | {
8 | [Required]
9 | [StringLength(7, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
10 | [DataType(DataType.Text)]
11 | [Display(Name = "Verification Code")]
12 | public string Code { get; set; }
13 |
14 | [BindNever]
15 | public string SharedKey { get; set; }
16 |
17 | [BindNever]
18 | public string AuthenticatorUri { get; set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Manage/ExternalLoginsViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Manage
2 | {
3 | using Microsoft.AspNetCore.Authentication;
4 | using Microsoft.AspNetCore.Identity;
5 | using System.Collections.Generic;
6 |
7 | public class ExternalLoginsViewModel
8 | {
9 | public IList CurrentLogins { get; set; }
10 |
11 | public IList OtherLogins { get; set; }
12 |
13 | public bool ShowRemoveButton { get; set; }
14 |
15 | public string StatusMessage { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Manage/IndexViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Manage
2 | {
3 | using System.ComponentModel.DataAnnotations;
4 |
5 | public class IndexViewModel
6 | {
7 | public string Username { get; set; }
8 |
9 | public bool IsEmailConfirmed { get; set; }
10 |
11 | [Required]
12 | [EmailAddress]
13 | public string Email { get; set; }
14 |
15 | [Phone]
16 | [Display(Name = "Phone number")]
17 | public string PhoneNumber { get; set; }
18 |
19 | public string StatusMessage { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Manage/RemoveLoginViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Manage
2 | {
3 | public class RemoveLoginViewModel
4 | {
5 | public string LoginProvider { get; set; }
6 | public string ProviderKey { get; set; }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Manage/SetPasswordViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Manage
2 | {
3 | using System.ComponentModel.DataAnnotations;
4 |
5 | public class SetPasswordViewModel
6 | {
7 | [Required]
8 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
9 | [DataType(DataType.Password)]
10 | [Display(Name = "New password")]
11 | public string NewPassword { get; set; }
12 |
13 | [DataType(DataType.Password)]
14 | [Display(Name = "Confirm new password")]
15 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
16 | public string ConfirmPassword { get; set; }
17 |
18 | public string StatusMessage { get; set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Manage/ShowRecoveryCodesViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Manage
2 | {
3 | public class ShowRecoveryCodesViewModel
4 | {
5 | public string[] RecoveryCodes { get; set; }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Manage/TwoFactorAuthenticationViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Manage
2 | {
3 | public class TwoFactorAuthenticationViewModel
4 | {
5 | public bool HasAuthenticator { get; set; }
6 |
7 | public int RecoveryCodesLeft { get; set; }
8 |
9 | public bool Is2faEnabled { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/MissingPeople/MissingPeoplePageListingModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.MissingPeople
2 | {
3 | using InterpolSystem.Services.Blog.Models;
4 | using Services.Models.MissingPeople;
5 | using Shared;
6 | using System.Collections.Generic;
7 |
8 | public class MissingPeoplePageListingModel : SearchFormViewModel
9 | {
10 | public IEnumerable MissingPeople { get; set; } = new List();
11 |
12 | public int TotalPages { get; set; }
13 |
14 | public int CurrentPage { get; set; }
15 |
16 | public int PreviousPage => this.CurrentPage == 1 ? 1 : this.CurrentPage - 1;
17 |
18 | public int NextPage => this.CurrentPage == this.TotalPages ? this.TotalPages : this.CurrentPage + 1;
19 |
20 | public IEnumerable Articles { get; set; }
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Shared/SearchFormViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Shared
2 | {
3 | using Data.Models.Enums;
4 | using Microsoft.AspNetCore.Mvc.Rendering;
5 | using System.Collections.Generic;
6 | using System.ComponentModel.DataAnnotations;
7 |
8 | public class SearchFormViewModel
9 | {
10 | public string SearchByFirstName { get; set; }
11 |
12 | public string SearchByLastName { get; set; }
13 |
14 | public string SearchByDistinguishMarks { get; set; }
15 |
16 | public int? SearchByAge { get; set; }
17 |
18 | [Display(Name = "Search by Gender")]
19 | public bool EnableGenderSearch { get; set; }
20 |
21 | public Gender SelectedGender { get; set; }
22 |
23 | [Display(Name = "Search by Country")]
24 | public bool EnableCountrySearch { get; set; }
25 |
26 | public IEnumerable Countries { get; set; }
27 |
28 | public int? SelectedCountryId { get; set; }
29 |
30 | public int SearchCriteriaTotalPages { get; set; }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/Shared/SubmitFormViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.Shared
2 | {
3 |
4 | using Microsoft.AspNetCore.Http;
5 | using System.ComponentModel.DataAnnotations;
6 |
7 | using static Data.DataConstants;
8 |
9 | public class SubmitFormViewModel
10 | {
11 | public int Id { get; set; }
12 |
13 | [Required]
14 | [MaxLength(PoliceDepartmentMaxLength)]
15 | public string PoliceDepartment { get; set; }
16 |
17 | [Required]
18 | [MaxLength(SubjectMaxLength)]
19 | [MinLength(SubjectMinLength)]
20 | public string Subject { get; set; }
21 |
22 | [Required]
23 | [MaxLength(MessageMaxLenght)]
24 | [MinLength(MessageMinLenght)]
25 | public string Message { get; set; }
26 |
27 | public IFormFile Image { get; set; }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Models/WantedPeople/WantedPeoplePageListingModel.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web.Models.WantedPeople
2 | {
3 | using InterpolSystem.Services.Blog.Models;
4 | using Services.Models.WantedPeople;
5 | using Shared;
6 | using System.Collections.Generic;
7 |
8 | public class WantedPeoplePageListingModel : SearchFormViewModel
9 | {
10 | public IEnumerable WantedPeople { get; set; } = new List();
11 |
12 | public int TotalPages { get; set; }
13 |
14 | public int CurrentPage { get; set; }
15 |
16 | public int PreviousPage => this.CurrentPage == 1 ? 1 : this.CurrentPage - 1;
17 |
18 | public int NextPage => this.CurrentPage == this.TotalPages ? this.TotalPages : this.CurrentPage + 1;
19 |
20 | public IEnumerable Articles {get; set;}
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Program.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web
2 | {
3 | using Microsoft.AspNetCore;
4 | using Microsoft.AspNetCore.Hosting;
5 |
6 | public class Program
7 | {
8 | public static void Main(string[] args)
9 | {
10 | BuildWebHost(args).Run();
11 | }
12 |
13 | public static IWebHost BuildWebHost(string[] args) =>
14 | WebHost.CreateDefaultBuilder(args)
15 | .UseStartup()
16 | .Build();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Account/AccessDenied.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Access denied";
3 | }
4 |
5 |
6 | @ViewData["Title"]
7 | You do not have access to this resource.
8 |
9 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Account/ConfirmEmail.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Confirm email";
3 | }
4 |
5 | @ViewData["Title"]
6 |
7 |
8 | Thank you for confirming your email.
9 |
10 |
11 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Account/ExternalLogin.cshtml:
--------------------------------------------------------------------------------
1 | @model ExternalLoginViewModel
2 | @{
3 | ViewData["Title"] = "Register";
4 | }
5 |
6 | @ViewData["Title"]
7 | Associate your @ViewData["LoginProvider"] account.
8 |
9 |
10 |
11 | You've successfully authenticated with @ViewData["LoginProvider"].
12 | Please enter an email address for this site below and click the Register button to finish
13 | logging in.
14 |
15 |
16 |
17 |
18 |
27 |
28 |
29 |
30 | @section Scripts {
31 | @await Html.PartialAsync("_ValidationScriptsPartial")
32 | }
33 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Account/ForgotPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ForgotPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Forgot your password?";
4 | }
5 |
6 | @ViewData["Title"]
7 | Enter your email.
8 |
9 |
10 |
11 |
20 |
21 |
22 |
23 | @section Scripts {
24 | @await Html.PartialAsync("_ValidationScriptsPartial")
25 | }
26 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Account/ForgotPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Forgot password confirmation";
3 | }
4 |
5 | @ViewData["Title"]
6 |
7 | Please check your email to reset your password.
8 |
9 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Account/Lockout.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Locked out";
3 | }
4 |
5 |
6 | @ViewData["Title"]
7 | This account has been locked out, please try again later.
8 |
9 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Account/LoginWith2fa.cshtml:
--------------------------------------------------------------------------------
1 | @model LoginWith2faViewModel
2 | @{
3 | ViewData["Title"] = "Two-factor authentication";
4 | }
5 |
6 | @ViewData["Title"]
7 |
8 | Your login is protected with an authenticator app. Enter your authenticator code below.
9 |
10 |
11 |
31 |
32 |
33 |
34 | Don't have access to your authenticator device? You can
35 | log in with a recovery code.
36 |
37 |
38 | @section Scripts {
39 | @await Html.PartialAsync("_ValidationScriptsPartial")
40 | }
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Account/LoginWithRecoveryCode.cshtml:
--------------------------------------------------------------------------------
1 | @model LoginWithRecoveryCodeViewModel
2 | @{
3 | ViewData["Title"] = "Recovery code verification";
4 | }
5 |
6 | @ViewData["Title"]
7 |
8 |
9 | You have requested to login with a recovery code. This login will not be remembered until you provide
10 | an authenticator app code at login or disable 2FA and login again.
11 |
12 |
13 |
14 |
23 |
24 |
25 |
26 | @section Scripts {
27 | @await Html.PartialAsync("_ValidationScriptsPartial")
28 | }
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Account/Register.cshtml:
--------------------------------------------------------------------------------
1 | @model RegisterViewModel
2 | @{
3 | ViewData["Title"] = "Register";
4 | }
5 |
6 | @ViewData["Title"]
7 |
8 |
9 |
10 |
46 |
47 |
48 |
49 | @section Scripts {
50 | @await Html.PartialAsync("_ValidationScriptsPartial")
51 | }
52 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Account/ResetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ResetPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Reset password";
4 | }
5 |
6 | @ViewData["Title"]
7 | Reset your password.
8 |
9 |
10 |
11 |
31 |
32 |
33 |
34 | @section Scripts {
35 | @await Html.PartialAsync("_ValidationScriptsPartial")
36 | }
37 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Account/ResetPasswordConfirmation.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Reset password confirmation";
3 | }
4 |
5 | @ViewData["Title"]
6 |
7 | Your password has been reset. Please click here to log in.
8 |
9 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Account/SignedOut.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Signed out";
3 | }
4 |
5 | @ViewData["Title"]
6 |
7 | You have successfully signed out.
8 |
9 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/ChangePassword.cshtml:
--------------------------------------------------------------------------------
1 | @model ChangePasswordViewModel
2 | @{
3 | ViewData["Title"] = "Change password";
4 | ViewData.AddActivePage(ManageNavPages.ChangePassword);
5 | }
6 |
7 | @ViewData["Title"]
8 | @Html.Partial("_StatusMessage", Model.StatusMessage)
9 |
10 |
11 |
30 |
31 |
32 |
33 | @section Scripts {
34 | @await Html.PartialAsync("_ValidationScriptsPartial")
35 | }
36 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/Disable2fa.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Disable two-factor authentication (2FA)";
3 | ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication);
4 | }
5 |
6 | @ViewData["Title"]
7 |
8 |
9 |
10 |
11 | This action only disables 2FA.
12 |
13 |
14 | Disabling 2FA does not change the keys used in authenticator apps. If you wish to change the key
15 | used in an authenticator app you should reset your
16 | authenticator keys.
17 |
18 |
19 |
20 |
21 |
24 |
25 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/EnableAuthenticator.cshtml:
--------------------------------------------------------------------------------
1 | @model EnableAuthenticatorViewModel
2 | @{
3 | ViewData["Title"] = "Enable authenticator";
4 | ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication);
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 | To use an authenticator app go through the following steps:
10 |
11 | -
12 |
13 | Download a two-factor authenticator app like Microsoft Authenticator for
14 | Windows Phone,
15 | Android and
16 | iOS or
17 | Google Authenticator for
18 | Android and
19 | iOS.
20 |
21 |
22 | -
23 |
Scan the QR Code or enter this key @Model.SharedKey into your two factor authenticator app. Spaces and casing do not matter.
24 | To enable QR code generation please read our documentation.
25 |
26 |
27 |
28 | -
29 |
30 | Once you have scanned the QR code or input the key above, your two factor authentication app will provide you
31 | with a unique code. Enter the code in the confirmation box below.
32 |
33 |
34 |
35 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | @section Scripts {
51 | @await Html.PartialAsync("_ValidationScriptsPartial")
52 | }
53 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/ExternalLogins.cshtml:
--------------------------------------------------------------------------------
1 | @model ExternalLoginsViewModel
2 | @{
3 | ViewData["Title"] = "Manage your external logins";
4 | ViewData.AddActivePage(ManageNavPages.ExternalLogins);
5 | }
6 |
7 | @Html.Partial("_StatusMessage", Model.StatusMessage)
8 | @if (Model.CurrentLogins?.Count > 0)
9 | {
10 | Registered Logins
11 |
12 |
13 | @foreach (var login in Model.CurrentLogins)
14 | {
15 |
16 | @login.LoginProvider
17 |
18 | @if (Model.ShowRemoveButton)
19 | {
20 |
27 | }
28 | else
29 | {
30 | @:
31 | }
32 |
33 |
34 | }
35 |
36 |
37 | }
38 | @if (Model.OtherLogins?.Count > 0)
39 | {
40 | Add another service to log in.
41 |
42 |
52 | }
53 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/GenerateRecoveryCodes.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Generate two-factor authentication (2FA) recovery codes";
3 | ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication);
4 | }
5 |
6 | @ViewData["Title"]
7 |
8 |
9 |
10 |
11 | This action generates new recovery codes.
12 |
13 |
14 | If you lose your device and don't have the recovery codes you will lose access to your account.
15 |
16 |
17 | Generating new recovery codes does not change the keys used in authenticator apps. If you wish to change the key
18 | used in an authenticator app you should reset your authenticator keys.
19 |
20 |
21 |
22 |
23 |
26 |
27 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model IndexViewModel
2 | @{
3 | ViewData["Title"] = "Profile";
4 | ViewData.AddActivePage(ManageNavPages.Index);
5 | }
6 |
7 | @ViewData["Title"]
8 | @Html.Partial("_StatusMessage", Model.StatusMessage)
9 |
10 |
11 |
40 |
41 |
42 |
43 | @section Scripts {
44 | @await Html.PartialAsync("_ValidationScriptsPartial")
45 | }
46 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/ManageNavPages.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc.Rendering;
6 | using Microsoft.AspNetCore.Mvc.ViewFeatures;
7 |
8 | namespace InterpolSystem.Web.Views.Manage
9 | {
10 | public static class ManageNavPages
11 | {
12 | public static string ActivePageKey => "ActivePage";
13 |
14 | public static string Index => "Index";
15 |
16 | public static string ChangePassword => "ChangePassword";
17 |
18 | public static string ExternalLogins => "ExternalLogins";
19 |
20 | public static string TwoFactorAuthentication => "TwoFactorAuthentication";
21 |
22 | public static string IndexNavClass(ViewContext viewContext) => PageNavClass(viewContext, Index);
23 |
24 | public static string ChangePasswordNavClass(ViewContext viewContext) => PageNavClass(viewContext, ChangePassword);
25 |
26 | public static string ExternalLoginsNavClass(ViewContext viewContext) => PageNavClass(viewContext, ExternalLogins);
27 |
28 | public static string TwoFactorAuthenticationNavClass(ViewContext viewContext) => PageNavClass(viewContext, TwoFactorAuthentication);
29 |
30 | public static string PageNavClass(ViewContext viewContext, string page)
31 | {
32 | var activePage = viewContext.ViewData["ActivePage"] as string;
33 | return string.Equals(activePage, page, StringComparison.OrdinalIgnoreCase) ? "active" : null;
34 | }
35 |
36 | public static void AddActivePage(this ViewDataDictionary viewData, string activePage) => viewData[ActivePageKey] = activePage;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/ResetAuthenticator.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Reset authenticator key";
3 | ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication);
4 | }
5 |
6 | @ViewData["Title"]
7 |
8 |
9 |
10 | If you reset your authenticator key your authenticator app will not work until you reconfigure it.
11 |
12 |
13 | This process disables 2FA until you verify your authenticator app and will also reset your 2FA recovery codes.
14 | If you do not complete your authenticator app configuration you may lose access to your account.
15 |
16 |
17 |
18 |
21 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/SetPassword.cshtml:
--------------------------------------------------------------------------------
1 | @model SetPasswordViewModel
2 | @{
3 | ViewData["Title"] = "Set password";
4 | ViewData.AddActivePage(ManageNavPages.ChangePassword);
5 | }
6 |
7 | Set your password
8 | @Html.Partial("_StatusMessage", Model.StatusMessage)
9 |
10 | You do not have a local username/password for this site. Add a local
11 | account so you can log in without an external login.
12 |
13 |
14 |
15 |
29 |
30 |
31 |
32 | @section Scripts {
33 | @await Html.PartialAsync("_ValidationScriptsPartial")
34 | }
35 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/ShowRecoveryCodes.cshtml:
--------------------------------------------------------------------------------
1 | @model ShowRecoveryCodesViewModel
2 | @{
3 | ViewData["Title"] = "Recovery codes";
4 | ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication);
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
10 |
11 | Put these codes in a safe place.
12 |
13 |
14 | If you lose your device and don't have the recovery codes you will lose access to your account.
15 |
16 |
17 |
18 |
19 | @for (var row = 0; row < Model.RecoveryCodes.Length; row += 2)
20 | {
21 | @Model.RecoveryCodes[row]
@Model.RecoveryCodes[row + 1]
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/TwoFactorAuthentication.cshtml:
--------------------------------------------------------------------------------
1 | @model TwoFactorAuthenticationViewModel
2 | @{
3 | ViewData["Title"] = "Two-factor authentication";
4 | ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication);
5 | }
6 |
7 | @ViewData["Title"]
8 | @if (Model.Is2faEnabled)
9 | {
10 | if (Model.RecoveryCodesLeft == 0)
11 | {
12 |
13 | You have no recovery codes left.
14 | You must generate a new set of recovery codes before you can log in with a recovery code.
15 |
16 | }
17 | else if (Model.RecoveryCodesLeft == 1)
18 | {
19 |
20 | You have 1 recovery code left.
21 | You can generate a new set of recovery codes.
22 |
23 | }
24 | else if (Model.RecoveryCodesLeft <= 3)
25 | {
26 |
27 | You have @Model.RecoveryCodesLeft recovery codes left.
28 | You should generate a new set of recovery codes.
29 |
30 | }
31 |
32 | Disable 2FA
33 | Reset recovery codes
34 | }
35 |
36 | Authenticator app
37 | @if (!Model.HasAuthenticator)
38 | {
39 | Add authenticator app
40 | }
41 | else
42 | {
43 | Configure authenticator app
44 | Reset authenticator key
45 | }
46 |
47 | @section Scripts {
48 | @await Html.PartialAsync("_ValidationScriptsPartial")
49 | }
50 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/_Layout.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "/Views/Shared/_Layout.cshtml";
3 | }
4 |
5 | Manage your account
6 |
7 |
8 | Change your account settings
9 |
10 |
11 |
12 | @await Html.PartialAsync("_ManageNav")
13 |
14 |
15 | @RenderBody()
16 |
17 |
18 |
19 |
20 | @section Scripts {
21 | @RenderSection("Scripts", required: false)
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/_ManageNav.cshtml:
--------------------------------------------------------------------------------
1 | @using InterpolSystem.Web.Views.Manage
2 | @inject SignInManager SignInManager
3 | @{
4 | var hasExternalLogins = (await SignInManager.GetExternalAuthenticationSchemesAsync()).Any();
5 | }
6 |
7 |
7 |
8 | @Model
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using InterpolSystem.Web.Views.Manage
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/MissingPeople/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model MissingPeoplePageListingModel
2 |
3 | @{
4 | ViewData["Title"] = "Missing People";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
10 |
37 |
38 |
39 |
40 | @await Html.PartialAsync("_MissingPeopleListingsPartial", Model)
41 |
42 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/MissingPeople/Search.cshtml:
--------------------------------------------------------------------------------
1 | @model MissingPeoplePageListingModel
2 |
3 | @{
4 | ViewData["Title"] = "Search results";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 | @if (Model.MissingPeople.Any())
10 | {
11 | Found @Model.SearchCriteriaTotalPages matched results.
12 |
13 |
14 | @await Html.PartialAsync("_MissingPeopleListingsPartial", Model)
15 |
16 | }
17 | else
18 | {
19 | No people to show.
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/MissingPeople/_MissingPeopleListingsPartial.cshtml:
--------------------------------------------------------------------------------
1 | @model MissingPeoplePageListingModel
2 |
3 | @{
4 | var previousDisabled = Model.CurrentPage == 1 ? "disabled" : string.Empty;
5 | var nextDisabled = Model.CurrentPage == Model.TotalPages ? "disabled" : string.Empty;
6 | }
7 |
8 |
9 |
10 | @foreach (var person in Model.MissingPeople)
11 | {
12 |
13 |
14 |
15 | Details
16 |
17 |
18 |
19 |
20 |
21 | @($"Name: {person.FirstName} {person.LastName}")
22 |
23 |
24 | @($"Age today: {DateTime.UtcNow.Year - person.DateOfBirth.Year} years old")
25 |
26 |
27 | @($"Nationality: {person.GivenNationalities}")
28 |
29 |
30 |
31 |
32 | }
33 |
34 |
42 |
43 |
44 | -
45 |
46 |
48 |
47 |
49 | @for (int i = 1; i <= Model.TotalPages; i++)
50 | {
51 | -
52 | @i
53 |
54 | }
55 | -
56 |
57 |
59 |
58 |
60 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/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 | 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.
22 |
23 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Shared/_LoginPartial.cshtml:
--------------------------------------------------------------------------------
1 | @using Microsoft.AspNetCore.Identity
2 | @using InterpolSystem.Web.Models
3 |
4 | @inject SignInManager SignInManager
5 | @inject UserManager UserManager
6 |
7 | @if (SignInManager.IsSignedIn(User))
8 | {
9 |
19 | }
20 | else
21 | {
22 |
2 |
3 |
4 |
5 |
6 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/WantedPeople/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model WantedPeoplePageListingModel
2 |
3 | @{
4 | ViewData["Title"] = "Wanted People";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 |
10 |
37 |
38 |
39 |
40 | @await Html.PartialAsync("_WantedPeopleListingsPartial", Model)
41 |
42 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/WantedPeople/Search.cshtml:
--------------------------------------------------------------------------------
1 | @model WantedPeoplePageListingModel
2 |
3 | @{
4 | ViewData["Title"] = "Search results";
5 | }
6 |
7 | @ViewData["Title"]
8 |
9 | @if (Model.WantedPeople.Any())
10 | {
11 | Found @Model.SearchCriteriaTotalPages matched results.
12 |
13 |
14 | @await Html.PartialAsync("_WantedPeopleListingsPartial", Model)
15 |
16 | }
17 | else
18 | {
19 | No people to show.
20 | }
21 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/WantedPeople/_WantedPeopleListingsPartial.cshtml:
--------------------------------------------------------------------------------
1 | @model WantedPeoplePageListingModel
2 |
3 | @{
4 | var previousDisabled = Model.CurrentPage == 1 ? "disabled" : string.Empty;
5 | var nextDisabled = Model.CurrentPage == Model.TotalPages ? "disabled" : string.Empty;
6 | }
7 |
8 |
9 |
10 | @foreach (var person in Model.WantedPeople)
11 | {
12 |
13 |
14 |
15 | Details
16 |
17 |
18 | @if (!person.IsCaught)
19 | {
20 |
21 | }
22 | else
23 | {
24 |
25 | }
26 |
27 |
28 | @($"Name: {person.FirstName} {person.LastName}")
29 |
30 |
31 | @($"Age today: {DateTime.UtcNow.Year - person.DateOfBirth.Year} years old")
32 |
33 |
34 | @($"Nationality: {person.GivenNationalities}")
35 |
36 |
37 |
38 |
39 | }
40 |
41 |
49 |
50 |
51 | -
52 |
53 |
55 |
54 |
56 | @for (int i = 1; i <= Model.TotalPages; i++)
57 | {
58 | -
59 | @i
60 |
61 | }
62 | -
63 |
64 |
66 |
65 |
67 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using Microsoft.AspNetCore.Identity
2 | @using InterpolSystem.Data.Models
3 | @using InterpolSystem.Data.Models.Enums
4 | @using InterpolSystem.Services.Models.MissingPeople
5 | @using InterpolSystem.Services.Models.WantedPeople
6 | @using InterpolSystem.Web
7 | @using InterpolSystem.Web.Infrastructure.Extensions
8 | @using InterpolSystem.Web.Models
9 | @using InterpolSystem.Web.Models.MissingPeople
10 | @using InterpolSystem.Web.Models.WantedPeople
11 | @using InterpolSystem.Web.Models.Account
12 | @using InterpolSystem.Web.Models.Manage
13 | @using InterpolSystem.Web.Models.Shared
14 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
15 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/WebConstants.cs:
--------------------------------------------------------------------------------
1 | namespace InterpolSystem.Web
2 | {
3 | public class WebConstants
4 | {
5 | public const string AdministratorRole = "Administrator";
6 | public const string WantedMissingPeopleRole = "BountyAdministrator";
7 | public const string BountyHunterRole = "BountyHunter";
8 | public const string BloggerRole = "Blogger";
9 | public const string TestRole = "Test";
10 | // public const string PoliceOfficerRole = "PoliceOfficer";
11 |
12 | public const string AdminArea = "Admin";
13 | public const string BountyAdminArea = "BountyAdmin";
14 | public const string BlogArea = "Blog";
15 | public const string BountyHunterArea = "BountyHunter";
16 |
17 | public const string TempDataErrorMessageKey = "ErrorMessage";
18 | public const string TempDataSuccessMessageKey = "SuccessMessage";
19 |
20 | public const string MissingPeopleControllerName = "MissingPeople";
21 | public const string WantedPeopleControllerName = "WantedPeople";
22 |
23 | public const string ValidForm = "ValidSubmitForm";
24 |
25 | public const int PageSize = 6;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "IncludeScopes": false,
4 | "LogLevel": {
5 | "Default": "Debug",
6 | "System": "Information",
7 | "Microsoft": "Information"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "IncludeScopes": false,
4 | "LogLevel": {
5 | "Default": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "asp.net",
3 | "private": true,
4 | "dependencies": {
5 | }
6 | }
--------------------------------------------------------------------------------
/InterpolSystem.Web/bundleconfig.json:
--------------------------------------------------------------------------------
1 | // Configure bundling and minification for the project.
2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241
3 | [
4 | {
5 | "outputFileName": "wwwroot/css/site.min.css",
6 | // An array of relative input file paths. Globbing patterns supported
7 | "inputFiles": [
8 | "wwwroot/css/site.css"
9 | ]
10 | },
11 | {
12 | "outputFileName": "wwwroot/js/site.min.js",
13 | "inputFiles": [
14 | "wwwroot/js/site.js"
15 | ],
16 | // Optionally specify minification options
17 | "minify": {
18 | "enabled": true,
19 | "renameLocals": true
20 | },
21 | // Optionally generate .map file
22 | "sourceMap": false
23 | }
24 | ]
25 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/css/site.min.css:
--------------------------------------------------------------------------------
1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}}
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/images/background-logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/images/background-logo.jpg
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/images/caught-logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/images/caught-logo.jpg
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/images/cyber-crime.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/images/cyber-crime.jpg
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/images/interpol-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/images/interpol-logo.png
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/images/shoot-logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/images/shoot-logo.jpg
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/images/skyscraper-attack.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/images/skyscraper-attack.jpg
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/js/site.js:
--------------------------------------------------------------------------------
1 | // Write your JavaScript code.
2 | let result;
3 | $(document).ready(function () {
4 | let element = $('');
5 |
6 | $("input, textarea").on('focus', function () {
7 | element.insertBefore($(this));
8 | });
9 | $("input, textarea").on('blur', function () {
10 | element.remove();
11 | });
12 |
13 | //animation for navbar
14 | $('.navbar .dropdown').hover(function () {
15 | $(this).find('.dropdown-menu').first().stop(true, true).slideToggle(400);
16 | }, function () {
17 | $(this).find('.dropdown-menu').first().stop(true, true).slideToggle(400)
18 | });
19 |
20 | //notification about submit forms
21 | result = $('.result').text();
22 | $('.result').css('display', 'none');
23 | if (result !=="") {
24 | let li = $("#SubmitFormWantedA");
25 | let span = $(` ${result} `)
26 | .css({
27 | 'background-color': 'red',
28 | 'border-radius': '50%',
29 | 'text-align': 'right',
30 | 'margin-left': '2px',
31 | 'margin-right': '2px'
32 | })
33 | .appendTo(li);
34 |
35 | let ul = $("#managePeopleA");
36 | let span2 = $(` ${result} `)
37 | .css({
38 | 'background-color': 'red',
39 | 'border-radius': '50%',
40 | 'text-align': 'right',
41 | 'margin-left': '2px',
42 | 'margin-right': '2px'
43 | })
44 | .prependTo(ul);
45 | }
46 |
47 | // right nav bar - articles
48 | let aElement = $('.list-group-item>a');
49 | aElement.css('text-decoration', 'none');
50 |
51 | aElement.on('mouseover', function () {
52 | $(this).fadeOut(300);
53 | $(this).fadeIn(600);
54 | $(this).addClass('text-danger');
55 | $(this).removeClass('glyphicon glyphicon-hand-right');
56 | $(this).css('font-size', '170%');
57 | });
58 |
59 | aElement.on('mouseout', function () {
60 | $(this).addClass('glyphicon glyphicon-hand-right');
61 | $(this).removeClass('text-danger');
62 | $(this).css('font-size', '100%');
63 | });
64 | });
65 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/js/site.min.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/js/site.min.js
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/lib/bootstrap/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bootstrap",
3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
4 | "keywords": [
5 | "css",
6 | "js",
7 | "less",
8 | "mobile-first",
9 | "responsive",
10 | "front-end",
11 | "framework",
12 | "web"
13 | ],
14 | "homepage": "http://getbootstrap.com",
15 | "license": "MIT",
16 | "moduleType": "globals",
17 | "main": [
18 | "less/bootstrap.less",
19 | "dist/js/bootstrap.js"
20 | ],
21 | "ignore": [
22 | "/.*",
23 | "_config.yml",
24 | "CNAME",
25 | "composer.json",
26 | "CONTRIBUTING.md",
27 | "docs",
28 | "js/tests",
29 | "test-infra"
30 | ],
31 | "dependencies": {
32 | "jquery": "1.9.1 - 3"
33 | },
34 | "version": "3.3.7",
35 | "_release": "3.3.7",
36 | "_resolution": {
37 | "type": "version",
38 | "tag": "v3.3.7",
39 | "commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86"
40 | },
41 | "_source": "https://github.com/twbs/bootstrap.git",
42 | "_target": "v3.3.7",
43 | "_originalSource": "bootstrap",
44 | "_direct": true
45 | }
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2016 Twitter, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/lib/bootstrap/dist/js/npm.js:
--------------------------------------------------------------------------------
1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
2 | require('../../js/transition.js')
3 | require('../../js/alert.js')
4 | require('../../js/button.js')
5 | require('../../js/carousel.js')
6 | require('../../js/collapse.js')
7 | require('../../js/dropdown.js')
8 | require('../../js/modal.js')
9 | require('../../js/tooltip.js')
10 | require('../../js/popover.js')
11 | require('../../js/scrollspy.js')
12 | require('../../js/tab.js')
13 | require('../../js/affix.js')
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/lib/jquery-validation-unobtrusive/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-validation-unobtrusive",
3 | "version": "3.2.6",
4 | "homepage": "https://github.com/aspnet/jquery-validation-unobtrusive",
5 | "description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.",
6 | "main": [
7 | "jquery.validate.unobtrusive.js"
8 | ],
9 | "ignore": [
10 | "**/.*",
11 | "*.json",
12 | "*.md",
13 | "*.txt",
14 | "gulpfile.js"
15 | ],
16 | "keywords": [
17 | "jquery",
18 | "asp.net",
19 | "mvc",
20 | "validation",
21 | "unobtrusive"
22 | ],
23 | "authors": [
24 | "Microsoft"
25 | ],
26 | "license": "http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm",
27 | "repository": {
28 | "type": "git",
29 | "url": "git://github.com/aspnet/jquery-validation-unobtrusive.git"
30 | },
31 | "dependencies": {
32 | "jquery-validation": ">=1.8",
33 | "jquery": ">=1.8"
34 | },
35 | "_release": "3.2.6",
36 | "_resolution": {
37 | "type": "version",
38 | "tag": "v3.2.6",
39 | "commit": "13386cd1b5947d8a5d23a12b531ce3960be1eba7"
40 | },
41 | "_source": "git://github.com/aspnet/jquery-validation-unobtrusive.git",
42 | "_target": "3.2.6",
43 | "_originalSource": "jquery-validation-unobtrusive"
44 | }
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/lib/jquery-validation/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-validation",
3 | "homepage": "http://jqueryvalidation.org/",
4 | "repository": {
5 | "type": "git",
6 | "url": "git://github.com/jzaefferer/jquery-validation.git"
7 | },
8 | "authors": [
9 | "Jörn Zaefferer "
10 | ],
11 | "description": "Form validation made easy",
12 | "main": "dist/jquery.validate.js",
13 | "keywords": [
14 | "forms",
15 | "validation",
16 | "validate"
17 | ],
18 | "license": "MIT",
19 | "ignore": [
20 | "**/.*",
21 | "node_modules",
22 | "bower_components",
23 | "test",
24 | "demo",
25 | "lib"
26 | ],
27 | "dependencies": {
28 | "jquery": ">= 1.7.2"
29 | },
30 | "version": "1.14.0",
31 | "_release": "1.14.0",
32 | "_resolution": {
33 | "type": "version",
34 | "tag": "1.14.0",
35 | "commit": "c1343fb9823392aa9acbe1c3ffd337b8c92fed48"
36 | },
37 | "_source": "git://github.com/jzaefferer/jquery-validation.git",
38 | "_target": ">=1.8",
39 | "_originalSource": "jquery-validation"
40 | }
--------------------------------------------------------------------------------
/InterpolSystem.Web/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 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/lib/jquery/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery",
3 | "main": "dist/jquery.js",
4 | "license": "MIT",
5 | "ignore": [
6 | "package.json"
7 | ],
8 | "keywords": [
9 | "jquery",
10 | "javascript",
11 | "browser",
12 | "library"
13 | ],
14 | "homepage": "https://github.com/jquery/jquery-dist",
15 | "version": "2.2.0",
16 | "_release": "2.2.0",
17 | "_resolution": {
18 | "type": "version",
19 | "tag": "2.2.0",
20 | "commit": "6fc01e29bdad0964f62ef56d01297039cdcadbe5"
21 | },
22 | "_source": "git://github.com/jquery/jquery-dist.git",
23 | "_target": "2.2.0",
24 | "_originalSource": "jquery"
25 | }
--------------------------------------------------------------------------------
/InterpolSystem.Web/wwwroot/lib/jquery/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright jQuery Foundation and other contributors, https://jquery.org/
2 |
3 | This software consists of voluntary contributions made by many
4 | individuals. For exact contribution history, see the revision history
5 | available at https://github.com/jquery/jquery
6 |
7 | The following license applies to all parts of this software except as
8 | documented below:
9 |
10 | ====
11 |
12 | Permission is hereby granted, free of charge, to any person obtaining
13 | a copy of this software and associated documentation files (the
14 | "Software"), to deal in the Software without restriction, including
15 | without limitation the rights to use, copy, modify, merge, publish,
16 | distribute, sublicense, and/or sell copies of the Software, and to
17 | permit persons to whom the Software is furnished to do so, subject to
18 | the following conditions:
19 |
20 | The above copyright notice and this permission notice shall be
21 | included in all copies or substantial portions of the Software.
22 |
23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 |
31 | ====
32 |
33 | All files located in the node_modules and external directories are
34 | externally maintained libraries used by this software which have their
35 | own licenses; we recommend you read them, as their terms may differ from
36 | the terms above.
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Stefan Minchev
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # InterpolSystem
2 | Fourth semester project based on ASP.NET Core 2.0, EF Core, MSSQL, JQuery and Bootstrap
3 |
4 | AppVeyor - Tests status:
5 | [](https://ci.appveyor.com/project/stefanMinch3v/interpolsystem)
6 |
7 | #Random pics:
8 | 
9 | 
10 | 
11 | 
12 | 
13 | 
14 | 
15 | 
16 | 
17 | 
18 | 
--------------------------------------------------------------------------------
26 | }
27 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
--------------------------------------------------------------------------------
/InterpolSystem.Web/Views/Manage/_StatusMessage.cshtml:
--------------------------------------------------------------------------------
1 | @model string
2 |
3 | @if (!String.IsNullOrEmpty(Model))
4 | {
5 | var statusMessageClass = Model.StartsWith("Error") ? "danger" : "success";
6 |
Admiral of Interpoll 25 |
Tarim Abzhal 26 |
27 |
@ViewData["Title"]
8 | 9 |@ViewData["Title"]
8 | 9 |Username | 13 |Roles | 15 |Manage Roles | 16 |User options | 17 ||
---|---|---|---|---|
@user.Username | 24 |@user.Email | 25 |
26 | @if (user.RoleNames.Any())
27 | {
28 | @string.Join(", ", user.RoleNames)
29 | }
30 | else
31 | {
32 | Does not have any roles. 33 | } 34 | |
35 | 36 | 48 | | 49 |50 | 59 | | 60 |
@ViewData["Title"]
8 | 9 | 10 | 22 | 23 |@ViewData["Title"]
8 | 9 |Published by @Model.AuthorName on @Model.PublishDate.ToLocalTime()
10 |11 | @Html.Raw(Model.Content) 12 | 13 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Blog/Views/Articles/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable
@ViewData["Title"]
8 | 9 |-
4 | @foreach (var article in Model)
5 | {
6 |
-
7 |
8 | @article.Title
9 |
10 |
11 | published by @article.AuthorName on @article.PublishDate.ToLocalTime() 12 |
13 | }
14 |
@ViewData["Title"]
8 | 9 |@ViewData["Title"]
8 | 9 |@ViewData["Title"]
8 |9 | 41 | 42 |
@ViewData["Title"]
8 | 9 |@ViewData["Title"]
8 | 9 |@ViewData["Title"]
8 | 9 |Date of submission | 13 |Subject | 14 |Message | 15 |Police Department | 16 |Status | 17 |
---|---|---|---|---|
@form.SubmissionDate.ToLocalTime() | 24 |@form.Subject | 25 |@form.Message | 26 |@form.PoliceDepartment | 27 |
28 | @if (form.Status == FormOptions.Accepted)
29 | {
30 | Congrats! Take your certificate from
31 | here
32 | }
33 | else if (form.Status == FormOptions.Declined)
34 | {
35 | Your submission was declined. 36 | } 37 | else 38 | { 39 |Still waiting to be approved. 40 | } 41 | |
42 |
@ViewData["Title"]
7 |You do not have access to this resource.
8 |@ViewData["Title"]
6 |8 | Thank you for confirming your email. 9 |
10 |@ViewData["Title"]
7 |Associate your @ViewData["LoginProvider"] account.
8 |9 | 10 |
11 | You've successfully authenticated with @ViewData["LoginProvider"]. 12 | Please enter an email address for this site below and click the Register button to finish 13 | logging in. 14 |
15 | 16 |@ViewData["Title"]
7 |Enter your email.
8 |9 |
@ViewData["Title"]
6 |7 | Please check your email to reset your password. 8 |
9 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/Lockout.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Locked out"; 3 | } 4 | 5 |@ViewData["Title"]
7 |This account has been locked out, please try again later.
8 |@ViewData["Title"]
7 |8 |
Your login is protected with an authenticator app. Enter your authenticator code below.
9 |34 | Don't have access to your authenticator device? You can 35 | log in with a recovery code. 36 |
37 | 38 | @section Scripts { 39 | @await Html.PartialAsync("_ValidationScriptsPartial") 40 | } -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/LoginWithRecoveryCode.cshtml: -------------------------------------------------------------------------------- 1 | @model LoginWithRecoveryCodeViewModel 2 | @{ 3 | ViewData["Title"] = "Recovery code verification"; 4 | } 5 | 6 |@ViewData["Title"]
7 |8 |
9 | You have requested to login with a recovery code. This login will not be remembered until you provide 10 | an authenticator app code at login or disable 2FA and login again. 11 |
12 |@ViewData["Title"]
7 | 8 |@ViewData["Title"]
7 |Reset your password.
8 |9 |
@ViewData["Title"]
6 |7 | Your password has been reset. Please click here to log in. 8 |
9 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/SignedOut.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Signed out"; 3 | } 4 | 5 |@ViewData["Title"]
6 |7 | You have successfully signed out. 8 |
9 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/ChangePassword.cshtml: -------------------------------------------------------------------------------- 1 | @model ChangePasswordViewModel 2 | @{ 3 | ViewData["Title"] = "Change password"; 4 | ViewData.AddActivePage(ManageNavPages.ChangePassword); 5 | } 6 | 7 |@ViewData["Title"]
8 | @Html.Partial("_StatusMessage", Model.StatusMessage) 9 |@ViewData["Title"]
7 | 8 |10 | 11 | This action only disables 2FA. 12 |
13 |14 | Disabling 2FA does not change the keys used in authenticator apps. If you wish to change the key 15 | used in an authenticator app you should reset your 16 | authenticator keys. 17 |
18 |@ViewData["Title"]
8 |To use an authenticator app go through the following steps:
10 |-
11 |
-
12 |
13 | Download a two-factor authenticator app like Microsoft Authenticator for 14 | Windows Phone, 15 | Android and 16 | iOS or 17 | Google Authenticator for 18 | Android and 19 | iOS. 20 |
21 |
22 | -
23 |
Scan the QR Code or enter this key @Model.SharedKey into your two factor authenticator app. Spaces and casing do not matter.
24 |To enable QR code generation please read our documentation.25 | 26 | 27 |
28 | -
29 |
30 | Once you have scanned the QR code or input the key above, your two factor authentication app will provide you 31 | with a unique code. Enter the code in the confirmation box below. 32 |
33 |34 |46 |35 | 44 |45 |
47 |
Registered Logins
11 |@login.LoginProvider | 17 |18 | @if (Model.ShowRemoveButton) 19 | { 20 | 27 | } 28 | else 29 | { 30 | @: 31 | } 32 | | 33 |
Add another service to log in.
41 |42 | 52 | } 53 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/GenerateRecoveryCodes.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Generate two-factor authentication (2FA) recovery codes"; 3 | ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication); 4 | } 5 | 6 |
@ViewData["Title"]
7 | 8 |10 | 11 | This action generates new recovery codes. 12 |
13 |14 | If you lose your device and don't have the recovery codes you will lose access to your account. 15 |
16 |17 | Generating new recovery codes does not change the keys used in authenticator apps. If you wish to change the key 18 | used in an authenticator app you should reset your authenticator keys. 19 |
20 |@ViewData["Title"]
8 | @Html.Partial("_StatusMessage", Model.StatusMessage) 9 |@ViewData["Title"]
7 |9 | 10 | If you reset your authenticator key your authenticator app will not work until you reconfigure it. 11 |
12 |13 | This process disables 2FA until you verify your authenticator app and will also reset your 2FA recovery codes. 14 | If you do not complete your authenticator app configuration you may lose access to your account. 15 |
16 |Set your password
8 | @Html.Partial("_StatusMessage", Model.StatusMessage) 9 |10 | You do not have a local username/password for this site. Add a local 11 | account so you can log in without an external login. 12 |
13 |@ViewData["Title"]
8 |10 | 11 | Put these codes in a safe place. 12 |
13 |14 | If you lose your device and don't have the recovery codes you will lose access to your account. 15 |
16 |@Model.RecoveryCodes[row]
@Model.RecoveryCodes[row + 1]
22 | } 23 |
@ViewData["Title"]
8 | @if (Model.Is2faEnabled) 9 | { 10 | if (Model.RecoveryCodesLeft == 0) 11 | { 12 |You must generate a new set of recovery codes before you can log in with a recovery code.
15 |You can generate a new set of recovery codes.
22 |You should generate a new set of recovery codes.
29 |Authenticator app
37 | @if (!Model.HasAuthenticator) 38 | { 39 | Add authenticator app 40 | } 41 | else 42 | { 43 | Configure authenticator app 44 | Reset authenticator key 45 | } 46 | 47 | @section Scripts { 48 | @await Html.PartialAsync("_ValidationScriptsPartial") 49 | } 50 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "/Views/Shared/_Layout.cshtml"; 3 | } 4 | 5 |Manage your account
6 | 7 |Change your account settings
9 |10 |
@ViewData["Title"]
8 |9 |
39 |
@ViewData["Title"]
8 | 9 | @if (Model.MissingPeople.Any()) 10 | { 11 |Found @Model.SearchCriteriaTotalPages matched results.
12 | 13 |No people to show.
20 | } 21 | 22 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/MissingPeople/_MissingPeopleListingsPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model MissingPeoplePageListingModel 2 | 3 | @{ 4 | var previousDisabled = Model.CurrentPage == 1 ? "disabled" : string.Empty; 5 | var nextDisabled = Model.CurrentPage == Model.TotalPages ? "disabled" : string.Empty; 6 | } 7 | 8 |20 |
21 | @($"Name: {person.FirstName} {person.LastName}") 22 |
23 |24 | @($"Age today: {DateTime.UtcNow.Year - person.DateOfBirth.Year} years old") 25 |
26 |27 | @($"Nationality: {person.GivenNationalities}") 28 |
29 |-
44 |
- 45 | 46 | 48 | 47 | 49 | @for (int i = 1; i <= Model.TotalPages; i++) 50 | { 51 |
- 52 | @i 53 | 54 | } 55 |
- 56 | 57 | 59 | 58 | 60 |
Error.
7 |An error occurred while processing your request.
8 | 9 | @if (Model.ShowRequestId) 10 | { 11 |
12 | Request ID: @Model.RequestId
13 |
Development Mode
17 |18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |
20 |21 | 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. 22 |
23 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Identity 2 | @using InterpolSystem.Web.Models 3 | 4 | @inject SignInManager@ViewData["Title"]
8 |9 |
39 |
@ViewData["Title"]
8 | 9 | @if (Model.WantedPeople.Any()) 10 | { 11 |Found @Model.SearchCriteriaTotalPages matched results.
12 | 13 |No people to show.
20 | } 21 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/WantedPeople/_WantedPeopleListingsPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model WantedPeoplePageListingModel 2 | 3 | @{ 4 | var previousDisabled = Model.CurrentPage == 1 ? "disabled" : string.Empty; 5 | var nextDisabled = Model.CurrentPage == Model.TotalPages ? "disabled" : string.Empty; 6 | } 7 | 8 |
27 |
28 | @($"Name: {person.FirstName} {person.LastName}") 29 |
30 |31 | @($"Age today: {DateTime.UtcNow.Year - person.DateOfBirth.Year} years old") 32 |
33 |34 | @($"Nationality: {person.GivenNationalities}") 35 |
36 |-
51 |
- 52 | 53 | 55 | 54 | 56 | @for (int i = 1; i <= Model.TotalPages; i++) 57 | { 58 |
- 59 | @i 60 | 61 | } 62 |
- 63 | 64 | 66 | 65 | 67 |