def login(request):
    # Create an empty authentication form.
    form = CustomAuthForm()
    if request.method == "POST":
        # Add received data to form.
        form = CustomAuthForm(data=request.POST)

        # Retrieve the credentials.
        server = form.data["server"]
        username = form.data["username"]
        password = form.data["password"]

        # Validate credentials.
        dc = request.session.get("dc")
        if not dc:
            dc = DeviceCloud(username, password, base_url=server)

        # If the user exists, do manual login and redirect to main page.
        if dc is not None and dc.has_valid_credentials():
            user = DeviceCloudUser(server, username, password)
            request.session["user"] = user.to_json()
            request.session["locations"] = {}
            request.session.modified = True
            return redirect_dest(request)

    return render(request, "login.html", {'form': form})
def get_authenticated_dc():
    while True:
        user = raw_input("username: "******"password: "******"https://login-etherios-com-2v5p9uat81qu.runscope.net")
        if dc.has_valid_credentials():
            print ("Credentials accepted!")
            return dc
        else:
            print ("Invalid username or password provided, try again")
Exemple #3
0
def get_authenticated_dc():
    while True:
        user = raw_input("username: "******"password: "******"Credentials accepted!")
            return dc
        else:
            print("Invalid username or password provided, try again")
def get_authenticated_dc():
    while True:
        user = raw_input("username: "******"password: "******"Credentials accepted!")
            return dc
        else:
            print ("Invalid username or password provided, try again")
def get_authenticated_dc():
    while True:
        user = raw_input("username: "******"password: "******"https://login-etherios-com-2v5p9uat81qu.runscope.net")
        if dc.has_valid_credentials():
            print("Credentials accepted!")
            return dc
        else:
            print("Invalid username or password provided, try again")
def get_authenticated_dc():
    while True:
        base_url = os.environ.get('DC_BASE_URL', 'https://devicecloud.digi.com')

        username = os.environ.get('DC_USERNAME', None)
        if not username:
            username = input("username: "******"password: "******"Credentials accepted!")
            return dc
        else:
            print("Invalid username or password provided, try again")