Fakultas Ilmu Komputer UI

Commit 8f652f6e authored by zakiraihan's avatar zakiraihan
Browse files

Adjust styling and activate notif

parent 1efc3aeb
......@@ -45,8 +45,23 @@ def set_webhook():
def hello():
return "Hello World!"
@app.route('/sendNotification', methods=['POST'])
def sendNotif():
@app.route('/sendNotification/custom', methods=['POST'])
def sendNotifCustom():
from models.AccountModel import AccountModel
req_data = request.get_json()
user = AccountModel.query.filter(AccountModel.ssoId==req_data['username']).first()
if (user is None):
return {'status': 404, 'message': 'User not found'}
elif (user.chatId == None):
return {'status': 500, 'message': 'User notification is being turned off'}
else:
param = urllib.parse.urlencode({'chat_id': user.chatId, 'text': req_data['message']})
url = "https://api.telegram.org/bot" + TOKEN + "/sendMessage?" + param
r = requests.get(url = url)
return r.json()
@app.route('/sendNotification/sisurat', methods=['POST'])
def sendNotifSisurat():
from models.AccountModel import AccountModel
req_data = request.get_json()
user = AccountModel.query.filter(AccountModel.ssoId==req_data['username']).first()
......
.makeSureBox {
width: 400px;
max-width: 400px;
display: inline-block;
border: 2px solid #000;
border-radius: 10px;
overflow: hidden;
margin-top: 30px;
}
.boxTitle {
padding-top: 15px;
color: white;
background-color: #5c94bd;
border-bottom: 2px solid #000;
}
.ssoContent {
padding-right: 23px;
padding-left: 23px;
}
.ssoBtn {
margin-bottom: 15px;
border-radius: 10px;
background-color: #5c94bd;
border-color: #5c94bd;
}
.ssoLoginBtn {
margin-bottom: 15px;
border-radius: 10px;
}
\ No newline at end of file
......@@ -34,6 +34,8 @@ def save_user_notif_activation_data(bot, chat_id, contact):
bot.sendMessage(chat_id=chat_id, text="You are not logged in yet", reply_markup=ReplyKeyboardRemove())
else:
checkAccountExistance.chatId = chat_id
checkAccountExistance.firstName = contact.first_name
checkAccountExistance.lastName = contact.last_name
checkAccountExistance.update()
bot.sendMessage(chat_id=chat_id, text="Register success!!!", reply_markup=ReplyKeyboardRemove())
......
......@@ -8,37 +8,12 @@
<title>Login Fasilkom Telegram Bot</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://sso.ui.ac.id/cas/themes/ui/sso.css" />
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/default.css') }}">
<link rel="icon" href="https://sso.ui.ac.id/cas/themes/ui/logo2_0.gif" type="image/x-icon" />
<style>
.makeSureBox {
width: 400px;
max-width: 400px;
display: inline-block;
border: 2px solid #000;
border-radius: 10px;
overflow: hidden;
}
.boxTitle {
padding-top: 15px;
color: white;
background-color: #5c94bd;
border-bottom: 2px solid #000;
}
.ssoContent {
padding-right: 23px;
padding-left: 23px;
}
.ssoBtn {
margin-bottom: 15px;
border-radius: 10px;
background-color: #5c94bd;
border-color: #5c94bd;
}
</style>
</head>
<body>
<div class="container d-flex align-items-center justify-content-center min-vh-100">
<div class="container d-flex justify-content-center">
<div class="makeSureBox">
<div class="row d-flex justify-content-center boxTitle" >
<h5 style="text-align:center;">Fasilkom Telegram Bot Notification</h5>
......
......@@ -8,48 +8,25 @@
<title>Login Fasilkom Telegram Bot</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://sso.ui.ac.id/cas/themes/ui/sso.css" />
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/default.css') }}">
<link rel="icon" href="https://sso.ui.ac.id/cas/themes/ui/logo2_0.gif" type="image/x-icon" />
<style>
.makeSureBox {
width: 250px;
max-width: 250px;
display: inline-block;
border: 2px solid #000;
border-radius: 10px;
overflow: hidden;
}
.boxTitle {
padding-top: 15px;
color: white;
background-color: #5c94bd;
border-bottom: 2px solid #000;
}
.ssoMsg {
padding-right: 23px;
padding-left: 23px;
}
.ssoBtn {
margin-bottom: 15px;
border-radius: 10px;
}
</style>
</head>
<body>
<div class="container d-flex align-items-center justify-content-center min-vh-100">
<div class="container d-flex justify-content-center">
<div class="makeSureBox">
<div class="row d-flex justify-content-center boxTitle" >
<h5 style="text-align:center;">Fasilkom Telegram Bot Notification</h5>
</div>
<div style='clear:both'></div>
<br>
<div class="row ssoMsg">
<div class="row ssoContent">
<p style="text-align:justify;">
Mohon maaf proses authentifikasi gagal dikarenakan kesalahan username atau password, silahkan coba kembali dengan menekan tombol dibawah ini.
</p>
</div>
<div class="row d-flex justify-content-center align-items-center">
<a href="/loginsso" class="btn btn-warning ssoBtn" role="button">Login SSO</a>
<a href="/loginsso" class="btn btn-warning ssoLoginBtn" role="button">Login SSO</a>
</div>
</div>
</div>
......
......@@ -8,37 +8,12 @@
<title>Login Fasilkom Telegram Bot</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://sso.ui.ac.id/cas/themes/ui/sso.css" />
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/default.css') }}">
<link rel="icon" href="https://sso.ui.ac.id/cas/themes/ui/logo2_0.gif" type="image/x-icon" />
<style>
.makeSureBox {
width: 400px;
max-width: 400px;
display: inline-block;
border: 2px solid #000;
border-radius: 10px;
overflow: hidden;
}
.boxTitle {
padding-top: 15px;
color: white;
background-color: #5c94bd;
border-bottom: 2px solid #000;
}
.ssoContent {
padding-right: 23px;
padding-left: 23px;
}
.ssoBtn {
margin-bottom: 15px;
border-radius: 10px;
background-color: #5c94bd;
border-color: #5c94bd;
}
</style>
</head>
<body>
<div class="container d-flex align-items-center justify-content-center min-vh-100">
<div class="container d-flex justify-content-center">
<div class="makeSureBox">
<div class="row d-flex justify-content-center boxTitle" >
<h5 style="text-align:center;">Fasilkom Telegram Bot Notification</h5>
......
Markdown is supported
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