Commit 7ca10d09 authored by Jeff MrBE4R's avatar Jeff MrBE4R
Browse files

second commit

parent 5b96df9c
......@@ -125,6 +125,25 @@ def get_link_by_id( u_id ):
return link
def get_link_for_user( u_id ):
try:
link = config.Config.conn.execute(
select(
[
database.vms.c.token,
]
).where(
and_(
database.users_vms.c.user == int(u_id),
database.vms.c.id == database.users_vms.c.vm,
database.vms.c.enabled == True,
)
)
)
except:
link = []
return link
@app.route('/')
def home_page():
if 'logged_in' in session:
......@@ -187,7 +206,8 @@ def logout():
@app.route('/classroom')
def classroom():
if 'logged_in' in session:
return render_template('console.html', APP_NAME=config.Config.APP_NAME, APP_VERSION=config.Config.APP_VERSION, instance_uid="")
a = get_link_for_user(session['userid'])
return render_template('console.html', APP_NAME=config.Config.APP_NAME, APP_VERSION=config.Config.APP_VERSION, instance_uid=get_link_for_user(session['userid']))
else:
return redirect(url_for('login'))
......
......@@ -12,7 +12,7 @@
</tr>
</thead>
<tbody>
{% for vm in vms%}
{% for vm in vms %}
<tr>
<td>
{{ vm.token }}
......
......@@ -5,7 +5,9 @@
</div>
<script>
$(document).ready(function(){
div_content = '<iframe id="novnc" src="' + window.location.origin + '/vncws/vnc_auto.html?token={{ instance_uid }}&password=ubuntu" style="width:100%;"></iframe>';
{% for vm in instance_uid %}
div_content = '<iframe id="novnc" src="' + window.location.origin + '/vncws/vnc_auto.html?token={{ vm.token }}&password=ubuntu" style="width:100%;"></iframe>';
{% endfor %}
$('#content').html(div_content);
});
$(document).ready(
......
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