This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Configuration; | |
using System.Security.Claims; | |
using System.Threading.Tasks; | |
using System.Web.Helpers; | |
using EPiServer.Cms.UI.AspNetIdentity; | |
using EPiServer.Security; | |
using EPiServer.ServiceLocation; | |
using Microsoft.Owin; | |
using Microsoft.Owin.Extensions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MyNamespace.Web | |
{ | |
public class Startup | |
{ | |
const string LogoutUrl = "/util/logout.aspx"; | |
public void Configuration(IAppBuilder app) | |
{ | |
// Add CMS integration for ASP.NET Identity | |
app.AddCmsAspNetIdentity<ApplicationUser>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ Layout = null; } | |
@model MyNamespace.Models.LoginViewModel | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Log in</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta name="robots" content="noindex,nofollow" /> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MyNamespace.Controllers | |
{ | |
public class LoginController : Controller | |
{ | |
private UIUserProvider UIUserProvider => ServiceLocator.Current.GetInstance<UIUserProvider>(); | |
private UISignInManager UISignInManager => ServiceLocator.Current.GetInstance<UISignInManager>(); | |
public ActionResult Index() | |
{ | |
return View("/Views/Shared/Login.cshtml"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void RegisterRoutes(RouteCollection routes) | |
{ | |
base.RegisterRoutes(routes); | |
routes.MapRoute("Custom login", "Login/{action}/", new { controller = "Login", action = "Index" }); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LoginViewModel | |
{ | |
[Required] | |
[Display(Name = "Username")] | |
public string Username { get; set; } | |
[Required] | |
[DataType(DataType.Password)] | |
[Display(Name = "Password")] | |
[AllowHtml] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Display(Name = "Address or coordinates", Description = "Coordinates must be separated by white-space (e.g. \"55.5615205 12.9749824\")", Order = 40)] | |
[AutoSuggestSelection(typeof(GoogleMapsGeocoding), AllowCustomValues = false)] | |
public virtual string MapCoordinates { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MyNamespace | |
{ | |
[ServiceConfiguration(typeof(ISelectionQuery))] | |
public class GoogleMapsGeocoding : ISelectionQuery | |
{ | |
private readonly string _googleApiKey; | |
public GoogleMapsGeocoding() | |
{ | |
//get key from config | |
_googleApiKey = ConfigurationManager.AppSettings["GoogleGeocodingApiKey"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$webappname = "myepienvironment" # Application name (lowercase alphanumeric only) | |
$subscriptionname = "My subscription name" | |
$resourcegroupname ="$($webappname)-resourcegroup" | |
$location="West Europe" | |
$sqlservername = "$($webappname)-sqlserver" | |
$sqladminlogin = "SaUser" | |
$sqlpassword = "YourSecretAdminPassword1" | |
# The ip address range that you want to allow to access your SQL server - change as appropriate | |
$startip = "111.112.113.114" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$azurePassword = ConvertTo-SecureString "<your azure portal password>" -AsPlainText -Force | |
$psCred = New-Object System.Management.Automation.PSCredential("<your azure email address>", $azurePassword) | |
Login-AzureRmAccount -Credential $psCred | |
#scale down web app to "D1 Shared" | |
Set-AzureRmAppServicePlan -Name "<your sesrvice plan name>" -ResourceGroupName "<your resource group name>" -Tier Shared | |
#scale down database to "B1 Basic" | |
Set-AzureRmSqlDatabase -ResourceGroupName "<your resource group name>" -ServerName "<sql server name>" -DatabaseName "<database name>" -Edition Basic | |
#how to scale a web app to "B2 Basic" |
OlderNewer