def pyemon_input(): if 'username' in session: inputModel = input_model.Input() loginStatus = serverTools.getPyEmoncmsLogin() inputNames = [] if loginStatus["status"] is False: return redirect(url_for('houseLogin')) userModel = user_model.User() user = serverTools.getPyEmoncmsLogin() userId = str(userModel.get_id(user["user"])) inputs = inputModel.getList(userId) for uniqueInput in inputs: for key in list(uniqueInput.keys()): inputNames.append(key) user = userModel.get_user(userId) username = user[1] email = user[2] writeKey = user[3] readKey = user[4] return render_template('house/pyemoncms/input.html', inputs=inputs, inputNames=inputNames, username=username, email=email, writeKey=writeKey, readKey=readKey) return render_template('index.html')
def freePBX_welcome_nomanager(): if 'username' in session: loginstatus = serverTools.getPyEmoncmsLogin() if loginstatus["status"] is False: return redirect(url_for('freepbx/freepbxLogin')) return render_template('freepbx/views/welcome_nomanager.html') return render_template('index.html')
def pyemon_docs(): if 'username' in session: status = serverTools.getPyEmoncmsLogin() if status["status"] is False: return redirect(url_for('houseLogin')) userModel = user_model.User() user = serverTools.getPyEmoncmsLogin() userId = userModel.get_id(user["user"]) user = userModel.get_user(userId) username = user[1] email = user[2] writeKey = user[3] readKey = user[4] return render_template('house/pyemoncms/docs.html', username=username, email=email, writeKey=writeKey, readKey=readKey) return render_template('index.html')
def houseLogin(): if 'username' in session: global cms if cms is None: cms = cmsSettings.Settings() serverTools.setCMSSettings(cms) status = serverTools.getPyEmoncmsLogin() if status["status"] is False: return render_template('house/houseLogin.html') return redirect(url_for('pyemon_user')) return render_template('index.html')
def pyemon_user(): if 'username' in session: status = serverTools.getPyEmoncmsLogin() if status["status"] is False: return redirect(url_for('houseLogin')) userModel = user_model.User() user = serverTools.getPyEmoncmsLogin() userId = userModel.get_id(user["user"]) user = userModel.get_user(userId) username = user[1] email = user[2] writeKey = user[3] readKey = user[4] location = user[7] if int(user[8]) >= 0: timezone = "UTC +" + str(user[8]) else: timezone = "UTC " + str(user[8]) if user[9] == 'en_EN': language = 'American English' if user[10] is None: bio = "" else: bio = user[10] avatar = user[11] return render_template('house/pyemoncms/user.html', username=username, email=email, writeKey=writeKey, readKey=readKey, location=location, timezone=timezone, language=language, bio=bio, avatar=avatar) return render_template('index.html')