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
Hello |
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.Security.Claims; | |
using System.Threading.Tasks; | |
using Microsoft.AspNet.Identity; | |
using Microsoft.AspNet.Identity.EntityFramework; | |
namespace MFAAuth.Models | |
{ | |
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. | |
public class ApplicationUser : IdentityUser | |
{ |
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 RegisterViewModel | |
{ | |
[Required] | |
[EmailAddress] | |
[Display(Name = "Email")] | |
public string Email { get; set; } | |
[Required] | |
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] | |
[DataType(DataType.Password)] |
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
@model MFAAuth.Models.RegisterViewModel | |
@{ | |
ViewBag.Title = "Register"; | |
} | |
<h2>@ViewBag.Title.</h2> | |
@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) | |
{ | |
@Html.AntiForgeryToken() |
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
// | |
// POST: /Account/Login | |
[HttpPost] | |
[AllowAnonymous] | |
[ValidateAntiForgeryToken] | |
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl) | |
{ | |
if (ModelState.IsValid) | |
{ | |
var user = await UserManager.FindAsync(model.Email, model.Password); |
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
// | |
// POST: /Account/Register | |
[HttpPost] | |
[AllowAnonymous] | |
[ValidateAntiForgeryToken] | |
public async Task<ActionResult> Register(RegisterViewModel model) | |
{ | |
if (ModelState.IsValid) | |
{ | |
var user = new ApplicationUser() { UserName = model.Email, Email = model.Email, CountryCode = mode.CountryCode, PIN = model.PIN, Phone = model.Phone }; |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="Remove index.php rule" stopProcessing="true"> | |
<match url=".*" ignoreCase="false"/> | |
<conditions> | |
<add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" /> | |
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> |
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
#!/usr/bin/env bash | |
docker rm $(docker ps -qf 'status=exited') | |
docker rmi $(docker images -qf 'dangling=true') | |
docker volume rm $(docker volume ls -qf 'dangling=true') |
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
#!/bin/bash | |
# update-openvpn-certs.sh | |
/usr/local/openvpn_as/scripts/sacli --key "cs.priv_key" --value_file "/etc/letsencrypt/live/<YOUR DOMAIN NAME>/privkey.pem" ConfigPut | |
/usr/local/openvpn_as/scripts/sacli --key "cs.cert" --value_file "/etc/letsencrypt/live/<YOUR DOMAIN NAME>/fullchain.pem" ConfigPut | |
/usr/local/openvpn_as/scripts/sacli --key "cs.ca_bundle" --value_file "/etc/letsencrypt/live/<YOUR DOMAIN NAME>/chain.pem" ConfigPut | |
/usr/local/openvpn_as/scripts/sacli start |
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
#!/bin/bash | |
# IMPORTANT: Make sure your VM's network security rules allows access over TCP Port 80. | |
# This is required to pass the HTTP challenge. | |
# Download: curl -o setup.sh <raw URL of this gist> | |
# Enable execution: sudo chmod +x setup.sh | |
# Run: ./setup.sh -d "yourdomain.tld" -e "[email protected]" | |
while getopts d:e: option |
OlderNewer