Skip to content

Commit

Permalink
Merge pull request #147 from isard-vdi/release-1.1.1
Browse files Browse the repository at this point in the history
Release 1.1.1
  • Loading branch information
jvinolas authored Mar 19, 2019
2 parents 371e5b6 + 6ce8b00 commit 9a0970a
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file.

## [1.1.1] - 2019-03-19

### Fixed
- Bug with user password update from admin that updated all the user passwords at the same time.
- Bug when acessing IsardVDI from an https port different from 443.

## [1.1.0] - 2019-02-26 | Canigó

### Added
Expand Down
6 changes: 3 additions & 3 deletions src/webapp/admin/views/AdminHypersViews.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
@login_required
@isAdmin
def admin_hypervisors():
hypers=app.adminapi.hypervisors_get()
return render_template('admin/pages/hypervisors.html', title="Hypervisors", header="Hypervisors", nav="Hypervisors",hyp=hypers)
# ~ hypers=app.adminapi.hypervisors_get()
return render_template('admin/pages/hypervisors.html', title="Hypervisors", header="Hypervisors", nav="Hypervisors")

@app.route('/admin/hypervisors/json')
@app.route('/admin/hypervisors/json/<id>')
Expand All @@ -57,7 +57,7 @@ def hypervisors_pools_get():
create_dict['interfaces']=[create_dict['interfaces']]
if res is True:
flash('Hypervisor pool '+create_dict['id']+' added to the system.','success')
return redirect(url_for('admin_hypervisors'))
return render_template('admin/pages/hypervisors.html', title="Hypervisors", header="Hypervisors", nav="Hypervisors")
else:
flash('Could not create hypervisor pool. Maybe you have one with the same name?','danger')
return render_template('pages/hypervisors.html', nav="Hypervisors")
Expand Down
2 changes: 1 addition & 1 deletion src/webapp/admin/views/AdminViews.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@login_required
@isAdmin
def admin():
return redirect(url_for('admin_hypervisors'))
return render_template('admin/pages/hypervisors.html', title="Hypervisors", header="Hypervisors", nav="Hypervisors")

@app.route('/admin/table/<table>/get')
@login_required
Expand Down
16 changes: 14 additions & 2 deletions src/webapp/admin/views/UpdatesViews.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,27 @@ def admin_updates_register():
except Exception as e:
log.error('Error registering client: '+str(e))
#~ return False
return redirect(url_for('admin_updates'))
if not u.is_conected():
flash("There is a network or update server error at the moment. Try again later.","error")
return render_template('admin/pages/updates.html', title="Updates", nav="Updates", registered=False, connected=False)
registered=u.is_registered()
if not registered:
flash("IsardVDI hasn't been registered yet.","error")
return render_template('admin/pages/updates.html', title="Updates", nav="Updates", registered=registered, connected=True)

@app.route('/admin/updates_reload', methods=['POST'])
@login_required
@isAdmin
def admin_updates_reload():
if request.method == 'POST':
u.reload_updates()
return redirect(url_for('admin_updates'))
if not u.is_conected():
flash("There is a network or update server error at the moment. Try again later.","error")
return render_template('admin/pages/updates.html', title="Updates", nav="Updates", registered=False, connected=False)
registered=u.is_registered()
if not registered:
flash("IsardVDI hasn't been registered yet.","error")
return render_template('admin/pages/updates.html', title="Updates", nav="Updates", registered=registered, connected=True)

@app.route('/admin/updates/<kind>', methods=['GET'])
@login_required
Expand Down
2 changes: 1 addition & 1 deletion src/webapp/admin/views/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ def decorated_view(*args, **kwargs):
if current_user.is_admin:
return fn(*args, **kwargs)
logout_user()
return redirect(url_for('index'))
return render_template('login_disposables.html', disposables='')
return decorated_view
2 changes: 1 addition & 1 deletion src/webapp/lib/admin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def user_edit(self,user):
def user_passwd(self,user):
p = Password()
usr = {'password': p.encrypt(user['password'])}
return self.check(r.table('users').update(usr).run(db.conn),'replaced')
return self.check(r.table('users').get(user['id']).update(usr).run(db.conn),'replaced')

def user_toggle_active(self,id):
with app.app_context():
Expand Down
10 changes: 6 additions & 4 deletions src/webapp/views/LoginViews.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def login():
login_user(user)
flash('Logged in successfully.','success')
if user.is_admin:
return redirect(url_for('admin'))
return redirect(url_for('desktops'))
return render_template('admin/pages/hypervisors.html', title="Hypervisors", header="Hypervisors", nav="Hypervisors")
return render_template('pages/desktops.html', title="Desktops", nav="Desktops")
else:
flash('Username not found or incorrect password.','warning')
remote_addr=request.headers['X-Forwarded-For'].split(',')[0] if 'X-Forwarded-For' in request.headers else request.remote_addr.split(',')[0]
Expand All @@ -39,7 +39,7 @@ def index():
try:
if current_user.is_authenticated:
if current_user.is_admin:
return redirect(url_for('admin'))
return render_template('admin/pages/hypervisors.html', title="Hypervisors", header="Hypervisors", nav="Hypervisors")
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
Expand All @@ -54,7 +54,9 @@ def index():
def logout():
logout_ram_user(current_user.username)
logout_user()
return redirect(url_for('index'))
remote_addr=request.headers['X-Forwarded-For'].split(',')[0] if 'X-Forwarded-For' in request.headers else request.remote_addr.split(',')[0]
disposables=app.isardapi.show_disposable(remote_addr)
return render_template('login_disposables.html', disposables=disposables if disposables else '')

#~ @app.route('/autologin_secret/<secret>/<user>',methods=['GET'])
#~ def autologin(secret,user):
Expand Down
4 changes: 2 additions & 2 deletions src/webapp/views/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ def decorated_view(*args, **kwargs):

if id.startswith('_'+current_user.id+'_'):
return fn(*args, **kwargs)
return redirect(url_for('index'))
return render_template('login_disposables.html', disposables='')
return decorated_view

def checkRole(fn):
@wraps(fn)
def decorated_view(*args, **kwargs):
if current_user.role == 'user': return redirect(url_for('desktops'))
if current_user.role == 'user': return render_template('pages/desktops.html', title="Desktops", nav="Desktops")
return fn(*args, **kwargs)
return decorated_view

0 comments on commit 9a0970a

Please sign in to comment.