Fakultas Ilmu Komputer UI

Commit 1bcd73e1 authored by zakiraihan's avatar zakiraihan
Browse files

Add interface if user already login

parent 8f652f6e
......@@ -110,8 +110,12 @@ def getLoginSSOData():
@app.route('/loginsso/setPhoneNumber', methods=['GET'])
def renderSetPhoneNumber():
from telebot.utils import check_if_user_exist
username = request.args.get('username')
return render_template('authPhoneNumber.html', username=username)
if (check_if_user_exist(username)):
return render_template('accountExist.html', username=username)
else:
return render_template('authPhoneNumber.html', username=username)
@app.route('/submitPhoneNumber', methods=['POST'])
def createSSOAccount():
......
......@@ -12,4 +12,8 @@ def create_user_sso_account(username, phoneNumber):
else:
return "failed"
except Exception as e:
return "error"
\ No newline at end of file
return "error"
def check_if_user_exist(username):
checkAccountExistance = AccountModel.query.filter(AccountModel.ssoId==str(username)).first()
return checkAccountExistance != None
\ 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" 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" />
</head>
<body>
<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 ssoContent">
<p style="text-align:justify;">
SSO dengan username {{ username }} telah terdaftar
</p>
<p style="text-align:justify;">
Silahkan pilih apakah anda ingin logout atau mengganti nomor telepon.
</p>
</div>
<div class="row ssoContent d-flex justify-content-around align-items-center">
<a href="/logoutsso" class="btn btn-primary ssoBtn" role="button" type="submit">Logout SSO</a>
<a href="/changePhoneNumber" class="btn btn-primary ssoBtn" role="button" type="submit">Change Phone Number</a>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
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