Last active
December 26, 2016 07:57
-
-
Save tamizhvendan/634d28679a3206d69551dc7f751b28d3 to your computer and use it in GitHub Desktop.
Two Factor Authentication in Suave
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
{% extends "page.liquid" %} | |
{% block head %} | |
<title> Enter Verification Code </title> | |
{% endblock %} | |
{% block content %} | |
<div class="container"> | |
<form action="/verify_auth_code" method="POST" role="form"> | |
<div class="form-group"> | |
<label for="Code">Verification Code</label> | |
<input type="text" name="Code" id="Code" class="form-control" value=""> | |
</div> | |
<button type="submit" class="btn btn-primary btn-block">Login</button> | |
</form> | |
</div> | |
{% endblock %} |
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
{% extends "page.liquid" %} | |
{% block head %} | |
<title> Enable Two Factor Authentication </title> | |
{% endblock %} | |
{% block content %} | |
<div class="container"> | |
<div class="row"> | |
<div class="col-md-offset-2">Scan the QR Code with Google Authenticator and | |
enter the 6 digit code it generates</div> | |
</div> | |
<div class="row"> | |
<div class="col-md-8"> | |
<form action="/enable_two_factor" method="POST" role="form"> | |
<input type="hidden" name="SecretKey" value="{{model.Key}}"> | |
<div class="form-group"> | |
<label for="Code">Verification Code</label> | |
<input type="text" name="Code" id="Code" class="form-control" value=""> | |
</div> | |
<button type="submit" class="btn btn-primary btn-block">Enable</button> | |
</form> | |
{% if model.Err != "" %} | |
<p class="alert alert-danger">{{model.Err}}</p> | |
{% endif %} | |
</div> | |
<div class="col-md-4"> | |
<img src="{{model.Url}}"/> | |
</div> | |
</div> | |
</div> | |
{% endblock %} |
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
{% extends "page.liquid" %} | |
{% block head %} | |
<title> Login </title> | |
{% endblock %} | |
{% block content %} | |
<div class="container"> | |
{% if model != "" %} | |
<p class="alert alert-danger">{{model}}</p> | |
{% endif %} | |
<form method="POST" action="/login"> | |
<div class="form-group"> | |
<label for="Username">Username</label> | |
<input type="text" id="Username" name="Username"> | |
</div> | |
<div class="form-group"> | |
<label for="Password">Password</label> | |
<input type="password" id="Password" name="Password"> | |
</div> | |
<button class="btn btn-primary" type="submit">Login</button> | |
</form> | |
</div> | |
{% endblock %} |
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
<!-- Suave.TwoFactorAuth/views/page.liquid --> | |
<html> | |
<head> | |
{% block head %} | |
{% endblock %} | |
<!-- CSS Styles references ... --> | |
</head> | |
<body> | |
<div id="content"> | |
{% block content %} | |
{% endblock %} | |
</div> | |
<div id="scripts"> | |
<!-- JS libaries references ... --> | |
</div> | |
</body> | |
</html> |
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
{% extends "page.liquid" %} | |
{% block head %} | |
<title> {{model.Username}}'s Profile </title> | |
{% endblock %} | |
{% block content %} | |
<div class="container"> | |
<h2>Hi {{model.Username}}</h2> | |
<div> | |
{% if model.is_two_factor_auth_enabled %} | |
<a href="/disable_two_factor">Disable Two Factor Authentication</a> | |
{% else %} | |
<a href="/enable_two_factor">Enable Two Factor Authentication</a> | |
{% endif %} | |
<a href="/logout" class="btn btn-default">logout</a> | |
</div> | |
</div> | |
{% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment