Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sample Login Page
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Account Link</title>
<link href="/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet"/>
<script src="/js/jquery.js"></script>
<script src="/js/common_functions.js"></script>
<div class="wrapper">
<div class="container-fluid page-body">
<div class="page-header">
<h1>Link Bothub account</h1>
<div class="panel">
<div class="panel-body">
<div class="row">
<label>User name:</label>
<input class="pull-right" type="text" id="username"/>
<div class="row" style="margin-top:10px;">
<input class="pull-right" type="password" id="password"/>
<div class="row" style="margin-top:10px;">
<button onclick="account_link();" class="btn btn-success pull-right">Submit</button>
function validateParams() {
var username = $('#username').val();
var password = $('#password').val();
return username != '' && password != '';
function account_link() {
var redirect_uri = '<?php echo $redirect_uri;?>';
if (!validateParams()) {
alert('Please input user name and password');
// Substitude this ajax call with the operation needed to account verify codes for your system.
type: "POST",
url: '/users/account-verify/<?php echo $page_id?>',
data: {
'username': $('#username').val(),
'password': $('#password').val()
success: function (data) {
if (data.result) {
// If the account is correct, redirect the location to the redirect_uri parameter with authorization_code appended.
var authorization_code =;
var url = redirect_uri + '&authorization_code=' + authorization_code;
window.location.href = url;
} else {
// If the account is not correct, simply redirect the location to redirect_uri parameter.
window.location.href = redirect_uri;
dataType: 'json'
.page-body {
max-width: 300px;
text-align: center;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment