Exemple #1
0
def signup():
    form = SignUpForm()
    if form.is_submitted():
        result = request.form

        wk = al.workoutGen()
        wkls = None
        while(True):
            try:
                wkls = wk.generator(result.get("sport").lower().strip(), result.get("skillLevel").lower().strip())
                break
            except:
                pass

        wk1,wk2 = wk.formatter(wkls.wk)

        ################## NEW ########################

        archive.archive().archive(wk1,wk2,result.get("email")) #archiving the workout
 
        ################## NEW ########################
        
        return render_template('display.html', wk1=wk1, wk2=wk2, fName = result.get("first_name"), lName = result.get("last_name"), email = result.get("email"))


    return render_template('signup.html', form=form)
Exemple #2
0
def signup():
    form = SignUpForm()
    if form.is_submitted():
        User(username=form.username.data, password=form.password.data)
        users = orm.select(u for u in User)
        return render_template('user.html', result=users)

    return render_template('signup.html', form=form)
Exemple #3
0
def signup():
    form = SignUpForm()
    if form.is_submitted():
        result = request.form
        fullname = request.form.get("fullname")
        email = request.form.get("email")
        return render_template('user.html',
                               result=result,
                               fullname=fullname,
                               email=email)

    return render_template('signup.html', form=form)
def signup():
    form = SignUpForm()
    if form.is_submitted():
        result = request.form
        re = request.form['moviename']
        print(re)

        posts = rcmd(re)
        ll = len(posts)
        return render_template('user.html', posts=posts, re=re, ll=ll)
        #return render_template('user.html',result=result)

    return render_template('signup.html', form=form)
Exemple #5
0
def register():
    form = SignUpForm()
    if form.is_submitted():
        details = request.form
        print(details)
        firstname = details['firstname']
        lastname = details['lastname']
        department = details['department']
        email = details['email']
        query = """insert into app.employees (first_name,last_name,department,email,comment) values ('{}','{}','{}','{}','{}')""".format(firstname,lastname,department,email,comment)
        with db() as conn:
            conn.execute(query)
        return render_template('preview.html',firstname=firstname,lastname=lastname,department=department,email=email,comment=comment)
    return render_template('register_form.html',form=form,version=version)
Exemple #6
0
def signup():
    if current_user.is_authenticated:
        return render_view(url_for('dashboard'),
                           redirect=True,
                           message=_('SESSIONS_MSG_ALREADY_SIGNED_IN'))

    redirect_to = session.pop('redirect_to', None)

    if request.values.get('ret'):
        redirect_to = request.values.get('ret')

    form = SignUpForm(ret=redirect_to)

    if form.is_submitted():
        try:
            if not form.validate():
                raise Exception(_('ERROR_INVALID_SUBMISSION'))

            if not verify_captcha():
                raise Exception(_('SESSIONS_ERROR_UNFINISHED_CHALLENGE_LBL'))

            # Create user from the form
            user = User.create()

            form.populate_obj(user)
            user.set_password(form.password.data)
            user.last_seen = datetime.datetime.utcnow()
            user.last_login = datetime.datetime.utcnow()

            # store the user
            user.save()

            # Login User
            login_user(user)

            redirect_to = form.back_link.data

            if not redirect_to:
                redirect_to = url_for('dashboard')

            # send registration email
            send_email('registration', user)

            return render_view(redirect_to,
                               redirect=True,
                               message=_('SESSIONS_MSG_SIGNUP_COMPLETED'))
        except Exception as e:
            flash(e.message, 'error')

    return render_view('admin/sessions/signup.html', form=form)
Exemple #7
0
def deployment_info():
    form = SignUpForm()
    form1 = EnvironmentForm()
    if form.is_submitted() and form.submit.data:
        rs_token = request.form['password']
        obj = User1(rs_token)
        logging.info("Authenticating User RS token")
        response = obj.authenticate_user(rs_token)
        if response.status_code == 200:
            session['bearer_token'] = obj.bearer_token
            return render_template('second.html', form=form1)
        else:
            logging.error("Invalid RS Token")
            message = "Invalid RS Token, Please Re-try."
            return redirect(url_for('error', message=message))
Exemple #8
0
def retrieve():
    form = SignUpForm()
    if form.is_submitted():
        result = request.form

        try:
            wk1,wk2 = archive.archive().get(result.get("email"))

        except:
            return render_template('errorFound.html', err="The email address given doesn't exist within the database. It's likely a typo or an initial workout hasn't been generated yet")

        print("Workout for {} retreived".format(result.get("email")))

        return render_template('display.html', wk1=wk1, wk2=wk2, fName = "Archived", lName = "Result", email = result.get("email"))


    return render_template('retrieve.html', form=form)
Exemple #9
0
def login():
    form = SignUpForm()
    form1 = EnvironmentForm()
    form2 = RightScriptForm()

    if form.is_submitted() and form.submit.data:
        rs_token = request.form['password']
        obj = User1(rs_token)
        response = obj.authenticate_user(rs_token)
        if response.status_code == 200:
            session['bearer_token'] = obj.bearer_token
            return render_template('second.html', form=form1)
        else:
            return render_template('invalid.html')

    if form1.is_submitted() and form1.proceed.data:
        print("inside form1 submitted")
        result = request.form
        environment = result['environment']
        rel_v = result['release_version']
        service = result['service']
        print(service)
        bearer_token = session['bearer_token']
        dep_list = wfm.get_deployment_details(environment, rel_v, bearer_token)
        session['dep_list'] = dep_list
        dep_list1 = []
        for i in dep_list:
            a = json.loads(i)
            dep_list1.append(a)

        session['dep_list1'] = dep_list1
        return render_template('fourth.html', form=form2, dep_list=dep_list1)

    if form2.is_submitted() and form2.confirm.data:
        print("inside form2 submitted")
        User1.bearer_token = session['bearer_token']
        print(request.form.getlist('selected'))
        my_list = wfm.execute_right_script(request.form.getlist('selected'), request.form['rs_name'],
                                           session['bearer_token'])
        for response in my_list:
            print(response.content)
        return render_template('fourth.html', form=form2, dep_list=session['dep_list1'])

    return render_template('login.html', form=form)
Exemple #10
0
def signup():
    form = SignUpForm()
    if form.is_submitted():
        result = request.form
        """
        try:
            #sqlExe = "INSERT INTO userInfo({},{},{},{});".format(result.get("first_name"), result.get("last_name"), result.get("email"),result.get("sport"))
            #print(sqlExe)
            sqlExe = 'INSERT INTO "main"."userInfo"("first_name","last_name","email","sport") VALUES ("{}","{}","{}","{}");'.format(result.get("first_name"), result.get("last_name"), result.get("email"),result.get("sport"))
            db.session.execute(sqlExe)
            db.session.commit()

            print("Your info was successfully added")

        except Exception as e:
            print("Your query couldn't be inserted into the databse because: {}".format(e))


        #print(result)
        return render_template('user.html', result=result)

        """
        wk = al.workoutGen()
        wkls = None
        while (True):
            try:
                wkls = wk.generator(result.get("sport").lower())
                break
            except:
                pass

        wk1, wk2 = wk.formatter(wkls.wk)

        #print(wk1,wk2)

        return render_template('display.html',
                               wk1=wk1,
                               wk2=wk2,
                               fName=result.get("first_name"),
                               lName=result.get("last_name"),
                               email=result.get("email"))

    return render_template('signup.html', form=form)
Exemple #11
0
def signup():
    form = SignUpForm()
    if form.is_submitted():
        result = request.form
        return render_template('user.html', result=result)
    return render_template('signup.html', form=form)
def signin():
    form = SignUpForm()
    if form.is_submitted():
        result = request.form
        return render_template('dashboard.html', result=result)
    return render_template('admin.html', form=form)
Exemple #13
0
def home():
    netid = str(cas.username)

    # redirect instructors to ta portal
    cursor.execute("SELECT netid FROM instructors WHERE netid = (%s)",
                   (netid, ))
    isInstructor = True
    if cursor.fetchone() == None:
        isInstructor = False
    if isInstructor and (netid != 'kpetrino') and (netid != 'rfish'):
        return redirect(url_for('ta_portal'))

    form = SignUpForm()

    # check if already in queue
    inqueue = True
    cursor.execute("SELECT netid FROM queue where netid = (%s)", (netid, ))
    temp = cursor.fetchone()
    if temp == None:
        inqueue = False
    else:
        match = matches[netid]
        return render_template("index.html",
                               mynetid=netid,
                               form=form,
                               queue=get_queue(),
                               wait=get_wait(),
                               match=match)

    # form to join queue submitted
    if form.is_submitted() and not inqueue:
        queue = get_queue()
        result = request.form.to_dict()
        result["descrip"] = form.descrip.data
        cursor.execute("INSERT INTO queue VALUES (%s, %s, %s, %s, %s)",
                       (netid, form.name.data, form.prob.data, form.time.data,
                        form.descrip.data))
        conn.commit()
        # get match
        if len(queue) > 0:
            sim = 0
            match = queue[0]
            for stu in queue:
                sim_temp = jaccard(result, stu)
                if sim_temp > sim:
                    sim = sim_temp
                    match = stu
            matches[netid] = match
            return render_template("index.html",
                                   mynetid=netid,
                                   form=form,
                                   queue=get_queue(),
                                   wait=get_wait(),
                                   match=match)
        else:
            matches[netid] = netid

    return render_template("index.html",
                           mynetid=netid,
                           form=form,
                           queue=get_queue(),
                           wait=get_wait())