def POST_cleaner(): """ Insert and login new cleaner """ try: data = JSONencoder.load(request.data) id = cleaner.insert_new(data) c = cleaner.find_public(id=id) auth.login(c) return dumpJSON(c) except Exception as e: return respond500(e)
def auto_register(): ''' Once called, registers the bot to the slackr. ''' global user_data # check if bot has already been registered bot_id = discrete.find_uid("*****@*****.**") if bot_id != -1: print("Bot has already been registered") if not user_data[bot_id]["is_logged_in"]: login("*****@*****.**", "1010101000101010") return # register the bot register(bot_data["email"], bot_data["password"], bot_data["first_name"], bot_data["last_name"]) user_data[bot_id][ "profile_img_url"] = "http://127.0.0.1:8080/profileimages/bot.jpg"
def signin(request): context = {} if request.method.upper() == 'POST': data = yield from request.post() username = data.get('username') password = data.get('password') user = auth(username=username, password=password) if user: yield from login(request, user) return web.HTTPFound('/') else: context.update({ 'error': 'Wrong login or password' }) return render_template('signin.jinja2', request, context)
def auth_login(): data = request.get_json() return dumps(auth.login(data["email"], data["password"]))
def login(): return auth.login(auth0)
def login(username: str, password: str): auth.login(username, password)