Skip to content

Commit 1940f9d

Browse files
committed
Initial Commit
Initial Commit Application added
0 parents  commit 1940f9d

File tree

122 files changed

+16953
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+16953
-0
lines changed

.DS_Store

10 KB
Binary file not shown.

index.html

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<title>Login 08</title>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7+
8+
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700&display=swap" rel="stylesheet">
9+
10+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
11+
12+
<link rel="stylesheet" href="css/style.css">
13+
14+
</head>
15+
<body>
16+
<section class="ftco-section">
17+
<div class="container">
18+
<div class="row justify-content-center">
19+
<div class="col-md-6 text-center mb-5">
20+
<h2 class="heading-section">Login #08</h2>
21+
</div>
22+
</div>
23+
<div class="row justify-content-center">
24+
<div class="col-md-6 col-lg-5">
25+
<div class="login-wrap p-4 p-md-5">
26+
<div class="icon d-flex align-items-center justify-content-center">
27+
<span class="fa fa-user-o"></span>
28+
</div>
29+
<h3 class="text-center mb-4">Have an account?</h3>
30+
<form action="#" class="login-form">
31+
<div class="form-group">
32+
<input type="text" class="form-control rounded-left" placeholder="Username" required>
33+
</div>
34+
<div class="form-group d-flex">
35+
<input type="password" class="form-control rounded-left" placeholder="Password" required>
36+
</div>
37+
<div class="form-group d-md-flex">
38+
<div class="w-50">
39+
<label class="checkbox-wrap checkbox-primary">Remember Me
40+
<input type="checkbox" checked>
41+
<span class="checkmark"></span>
42+
</label>
43+
</div>
44+
<div class="w-50 text-md-right">
45+
<a href="#">Forgot Password</a>
46+
</div>
47+
</div>
48+
<div class="form-group">
49+
<button type="submit" class="btn btn-primary rounded submit p-3 px-5">Get Started</button>
50+
</div>
51+
</form>
52+
</div>
53+
</div>
54+
</div>
55+
</div>
56+
</section>
57+
58+
<script src="js/jquery.min.js"></script>
59+
<script src="js/popper.js"></script>
60+
<script src="js/bootstrap.min.js"></script>
61+
<script src="js/main.js"></script>
62+
63+
</body>
64+
</html>
65+

main.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<a href="https://colorlib.com/wp/templates/"><img src="https://colorlib.com/wp/wp-content/uploads/sites/2/colorlib-push-logo.png" alt="Colorlib logo"></a>
2+
<h1 style="text-align:center;">Thank you for using our template!</h1>
3+
<p style="text-align:center;">For more awesome templates please visit <strong><a href="https://colorlib.com/wp/templates/">Colorlib</a></strong>.</p>
4+
5+
<style>
6+
img {
7+
margin: 0 auto;
8+
display: block;
9+
margin-top: 20%;
10+
}
11+
</style>

main.py

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
from flask import Flask, render_template, request, redirect, url_for, jsonify, json, session
2+
from flask_socketio import SocketIO, emit
3+
import requests
4+
5+
app = Flask(__name__)
6+
app.config['SECRET_KEY'] = 'your-secret-key'
7+
socketio = SocketIO(app, engineio_logger=True, cors_allowed_origins='*')
8+
9+
# Store the mapping of clients and their names
10+
clients = {}
11+
12+
photo = ''
13+
username = ''
14+
15+
@app.route('/', methods=['GET', 'POST'])
16+
def login():
17+
if request.method == 'POST':
18+
form_username = request.form['username']
19+
form_password = request.form['password']
20+
21+
if form_username == '' and form_password == '':
22+
return """<script>
23+
alert('Error')
24+
</script>"""
25+
else:
26+
27+
url = f"http://hris.teamglac.com/api/users/login?u={form_username}&p={form_password}"
28+
response = requests.get(url).json()
29+
30+
if response['result'] == False:
31+
return """<script>
32+
alert('Error')
33+
</script>"""
34+
else:
35+
user_data = response["result"]
36+
session['fullname'] = user_data['fullname']
37+
global username
38+
username = session['fullname'] = user_data['fullname']
39+
photo_url = session['photo_url'] = user_data['photo_url']
40+
41+
global photo
42+
if photo_url == False:
43+
photo = """/assets/images/pngegg.png"""
44+
else:
45+
hris = "http://hris.teamglac.com/"
46+
session['photo_url'] = hris + user_data['photo_url']
47+
photo = session['photo_url'] = hris + user_data['photo_url']
48+
return redirect(url_for('index', success=True))
49+
50+
else:
51+
# Display the login form
52+
return render_template('login-auth.html')
53+
54+
@app.route('/index')
55+
def index():
56+
return render_template('chat.html', fullname_var=session['fullname'], photo=photo)
57+
58+
@app.route('/logout')
59+
def logout():
60+
# Clear the session and redirect to the login page
61+
session.clear()
62+
return redirect(url_for('login', success=True))
63+
64+
@socketio.on('connect')
65+
def handle_connect():
66+
if 'fullname' in session:
67+
fullname_var = session['fullname']
68+
photo = session['photo_url']
69+
socketio.emit('handle_data', {'fullname_var': fullname_var, 'photo': photo})
70+
print('Client connected:', fullname_var)
71+
72+
@socketio.on('disconnect')
73+
def handle_disconnect():
74+
if request.sid in clients:
75+
del clients[request.sid]
76+
print('Client disconnected')
77+
78+
@socketio.on('message')
79+
def handle_message(data):
80+
sender_name = clients.get(request.sid)
81+
print('sender data', sender_name)
82+
photo_var = session['photo_url']
83+
sender_name_here = session['fullname']
84+
is_sender = sender_name == session['fullname']
85+
emit('message', {'sender': sender_name_here, 'message': data['message'], 'is_sender': is_sender, 'photo_var': photo_var}, broadcast=True)
86+
87+
@socketio.on('join')
88+
def handle_join(data):
89+
clients[request.sid] = data['name']
90+
emit('join', {'message': f'{data["name"]} has joined the chat'}, broadcast=True)
91+
92+
if __name__ == '__main__':
93+
socketio.run(app, host='10.0.2.150', port='5000', debug=True)

static/assets/css/.DS_Store

6 KB
Binary file not shown.

static/assets/css/bootstrap.min.css

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/assets/css/bootstrap/.DS_Store

6 KB
Binary file not shown.
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.media {
2+
display: -webkit-box;
3+
display: -ms-flexbox;
4+
display: flex;
5+
-webkit-box-align: start;
6+
-ms-flex-align: start;
7+
align-items: flex-start; }
8+
9+
.media-body {
10+
-webkit-box-flex: 1;
11+
-ms-flex: 1;
12+
flex: 1; }
Binary file not shown.

static/assets/css/bootstrap/mixins/_border-radius.css

Whitespace-only changes.

static/assets/css/bootstrap/mixins/_screen-reader.css

Whitespace-only changes.

static/assets/css/bootstrap/mixins/_visibility.css

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.stretched-link::after {
2+
position: absolute;
3+
top: 0;
4+
right: 0;
5+
bottom: 0;
6+
left: 0;
7+
z-index: 1;
8+
pointer-events: auto;
9+
content: "";
10+
background-color: rgba(0, 0, 0, 0); }

static/assets/css/chat.css

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*------------------------------------
2+
Messages
3+
------------------------------------*/
4+
.unread {
5+
cursor: pointer;
6+
background-color: #f4f4f4;
7+
}
8+
9+
.messages-box {
10+
max-height: 28rem;
11+
overflow: auto;
12+
}
13+
14+
.online-circle {
15+
border-radius: 5rem;
16+
width: 5rem;
17+
height: 5rem;
18+
}
19+
20+
.messages-title {
21+
float: right;
22+
margin: 0px 5px;
23+
}
24+
25+
.message-img {
26+
float: right;
27+
margin: 0px 5px;
28+
}
29+
30+
.message-header {
31+
text-align: right;
32+
width: 100%;
33+
margin-bottom: 0.5rem;
34+
}
35+
36+
.text-editor {
37+
min-height: 18rem;
38+
}
39+
40+
.messages-list li.messages-you .messages-title {
41+
float: left;
42+
}
43+
44+
.messages-list li.messages-you .message-img {
45+
float: left;
46+
}
47+
48+
.messages-list li.messages-you p {
49+
float: left;
50+
text-align: left;
51+
}
52+
53+
.messages-list li.messages-you .message-header {
54+
text-align: left;
55+
}
56+
57+
.messages-list li p {
58+
max-width: 60%;
59+
padding: 5px;
60+
border: #e6e7e9 1px solid;
61+
}
62+
63+
.messages-list li.messages-me p {
64+
float: right;
65+
}
66+
67+
.ql-editor p {
68+
font-size: 1rem;
69+
}
70+
.messages-list li {
71+
list-style-type: none;
72+
}
73+
74+
.message-me {
75+
display: flex;
76+
flex-direction: row-reverse;
77+
align-items: center;
78+
}
79+
80+
.message-you {
81+
display: flex;
82+
flex-direction: row;
83+
align-items: center;
84+
}
85+
86+
.message-img {
87+
margin-right: 10px;
88+
}
89+
90+
.message-body {
91+
flex: 1;
92+
}
93+
94+
.messages-title {
95+
font-weight: bold;
96+
}
97+
98+
.time-messages {
99+
margin-left: 10px;
100+
}
101+
102+
.messages-p {
103+
margin: 0;
104+
}
105+

static/assets/css/emoji.css

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
body {
2+
background-color: gray;
3+
}* {
4+
font-family: Arial, Helvetica, san-serif;
5+
}
6+
.row:after, .row:before {
7+
content: " ";
8+
display: table;
9+
clear: both;
10+
}
11+
.span6 {
12+
float: left;
13+
width: 48%;
14+
padding: 1%;
15+
}
16+
17+
.emojionearea-standalone {
18+
float: right;
19+
}
20+
21+
.divOutside {
22+
height: 20px;
23+
width: 20px;
24+
background-position: -1px -26px;
25+
background-repeat: no-repeat;
26+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAABuCAYAAADMB4ipAAAHfElEQVRo3u1XS1NT2Rb+9uOcQF4YlAJzLymFUHaLrdxKULvEUNpdTnRqD532f+AHMLMc94gqR1Zbt8rBnUh3YXipPGKwRDoWgXvrYiFUlEdIkPPYZ/dAkwox5yQCVt/bzRrBPnt9e+211/etFeDQDu3ArL+/X37OeqmRWoH7+vpItfWawStF1tfXR+zW9xW5ne0p8loOcAKuCdwpRft60C8a+X5zTvebCqcAvmidf1GGHtqhHdpf1qqKzsrKipyensbi4iKWl5cBAMFgEG1tbYhGo2hpadlbmxseHpaDg4MAgI6ODng8HgBAPp/H/Pw8AODatWvo7e2tvUHrui7v3r2L+fl5XL58GVeuXIHH49m1N5/Py0ePHmF0dBQdHR24desWVFXdtYdXAn/48CHm5+dx8+ZNRKPRigEUDpuenpb3799H4YaOnWh5eVmOj48jFoshGo0STdPkwMCAXF5elqV7BgYGpKZpMhqNklgshrGx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eUUrE0vS63+c7/6uXMbDUWl/ssLczNFrVFddUT09AZpUy1LKvO0DVfPrfR9HxqfNbuEe185l9MFX3o6tIC5YpKFLWOfdQQ93Zu49j0+FDCDtjOp1yaOQCYhs4Y40wI05XfWj8yPT40Ua2ey33mEmMTtp2IUEq0nW3FKeJPGPjRp1Iz2QUuLUu66txG9NLVSK3gBZ+C1lcE54oqKOOCK6rm8QU2unu+u1ANuNynvFsBAG1ubbdMQ5eGviMAFDuP0w3sfMpvQEtb24fOQncU1bXl8R7JnOu+ZNv97XxKJwY6+PNPsrm13drObVqUMlMIU5OWpVHOc96Go5lTnV2fzC/VfAozD7HTCa6olBBa1Imlhbmq2lLuQ5xaW6nCPfnln0Yt7bDUhzhps8cfKH5//uTXmvS81OeLdqI/ZoROzSZrHqG/OvOPzxuhK5VgJTvV2bW3EdqJRABwrvvS/kfoSkoZvXT1YEbociHr7vnuYEfogpBFL109HKH/h0fomnXg3Lff79r7/MmvVbWG7gX4QObzc99+Tz7mHKah05KcW6ahQ9feS6cbMCdgt7eBWJagjCuUAC5tZzuouuo0Spm0hElc9R4cbf4bVl8v1p6WUmCuqEwIs34ruxaeeTy4uJVd67As08UVlVmWoG5vA7FLG3WMmHEupVTyW+vh2cn4DADMTsaTuc21LiGEhzHOnQ6gNtMrJSBMCKHkNt999WLi0S7hejEZH81n174WpukiIMw0dKq66p3Bw50RwhUVXFGJKUy28Xal48VkfKrSlWenhsc23q2cEB9SR7iiItwZIbbgHn8AlDFCCMW7laXjqZnHjkNpaubJzNuVpWZCKChjxOMPVH/QlaW0f/G3ZLqWWl6ce/bvlddp7yFD/w8Z+njoX1+GoZMjgzMAMDkyeLAMnRh+uKveJ0YGD4ahEyODFRk6OfrL/hj67GnckaHPng7vjaGzyYmaGDr77KktQ38H8tqx8Wja+WIAAAAASUVORK5CYII=);
27+
}
28+
.emojionearea-button
29+
{
30+
opacity:1 !important;
31+
}
32+

0 commit comments

Comments
 (0)