setup now automatically logs in

selenium-screenshot-testing
Kevin Chung 2017-03-10 11:12:58 -05:00
parent 967129a009
commit 15171f1140
1 changed files with 7 additions and 0 deletions

View File

@ -83,10 +83,17 @@ def setup():
db.session.add(page) db.session.add(page)
db.session.add(admin) db.session.add(admin)
db.session.commit() db.session.commit()
session['username'] = admin.name
session['id'] = admin.id
session['admin'] = admin.admin
session['nonce'] = sha512(os.urandom(10))
db.session.close() db.session.close()
app.setup = False app.setup = False
with app.app_context(): with app.app_context():
cache.clear() cache.clear()
return redirect(url_for('views.static_html')) return redirect(url_for('views.static_html'))
return render_template('setup.html', nonce=session.get('nonce')) return render_template('setup.html', nonce=session.get('nonce'))
return redirect(url_for('views.static_html')) return redirect(url_for('views.static_html'))