Fakultas Ilmu Komputer UI

Commit 70b5dc27 authored by zakiraihan's avatar zakiraihan
Browse files

add procfile to deploy on heroku, create sso login example

parent 551347b7
web: gunicorn app:app
...@@ -3,7 +3,7 @@ import requests ...@@ -3,7 +3,7 @@ import requests
import telegram import telegram
import urllib.parse import urllib.parse
from flask import Flask, request from flask import Flask, request, render_template
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
global bot global bot
...@@ -58,6 +58,10 @@ def sendNotif(): ...@@ -58,6 +58,10 @@ def sendNotif():
r = requests.get(url = url) r = requests.get(url = url)
return r.json() return r.json()
@app.route('/loginsso', methods=['GET'])
def renderLoginSSOPage():
return render_template('loginSSO.html')
if __name__ == '__main__': if __name__ == '__main__':
app.run(threaded=True) app.run(threaded=True)
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta content='width=device-width, initial-scale=1' name='viewport' />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Login Fasilkom Telegram Bot</title>
<link rel="stylesheet" type="text/css" href="https://sso.ui.ac.id/cas/themes/ui/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="https://sso.ui.ac.id/cas/themes/ui/sso.css" />
<link rel="icon" href="https://sso.ui.ac.id/cas/themes/ui/logo2_0.gif" type="image/x-icon" />
</head>
<body>
<div class="container">
<div class="main">
<div class="bg"></div>
<div class="login-box">
<form id="fm1" class="login" action="/cas/login" method="post">
<div class="top">
<div class="pull-right"><img src="https://sso.ui.ac.id/cas/themes/ui/logo.png" /></div>
<h1>SSO</h1>
<div class="sub">Single Sign On</div>
</div>
<div class="middle">
<p>Masukkan username dan password UI Anda/<br /><em>Enter your username and password</em>:</p>
<div class="form-group">
<input id="username" name="username" class="form-control" placeholder="Username" type="text" value="" autocomplete="false"/>
</div>
<div class="form-group">
<input id="password" name="password" class="form-control" placeholder="Password" type="password" value="" autocomplete="off"/>
</div>
</div>
<input type="hidden" name="lt" value="LT-103348-2cBkKRmmrCOb0xQdqc2hsTP2mdULjL" />
<input type="hidden" name="execution" value="e2s1" />
<input type="hidden" name="_eventId" value="submit" />
<div class="bottom clearfix">
<div class="pull-right" style="margin-top:12px">
<button type="submit" class="btn btn-lg btn-primary">Login</button>
</div>
<table>
<tr>
<!--
<td style="padding: 10px 10px 10px 10px;">
<div class="help"><a href="#">Lupa password<br /><em>Forget password</em></a></div>
</td>
-->
<td style="padding: 0px 10px 10px 10px;">
<div class="help"><a href="/account/user/register">Daftar Akun<br /><em>Guest Account</em></a></div>
</td>
<td style="border-left: solid #D5D5D5; ">
</td>
<td style="padding: 0px 0px 10px 10px;">
<div class="help"><a href="/account/static/frequently-asked-question-faq">Butuh Bantuan ?<br /><em>Need Help ?</em></a></div>
</td>
</tr>
</table>
</div>
</form>
</div>
<script type="text/javascript">
function hasError(input) {
if (input && /has-error/.test(input.parentElement.className)) return input;
}
function isEmpty(input) {
if (input && input.value == "") return input;
}
var u = document.getElementById("username");
var p = document.getElementById("password");
var candidates = [hasError(u), hasError(p), isEmpty(u), isEmpty(p), u];
for (var i = 0; i < candidates.length; ++i) {
if (candidates[i]) {
candidates[i].focus();
break;
}
}
</script>
</body>
</html>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment