Ejemplo n.º 1
0
def login():
    if request.method == "POST":
        user, authenticated = User.authenticate(db.session.query, request.form["email"], request.form["password"])
        if authenticated:
            session["user_id"] = user.id
            flash("You were logged in")
            return redirect(url_for("show_entries"))
        else:
            flash("Invalid email or password")
    return render_template("login.html")
Ejemplo n.º 2
0
def login():
    if request.method == 'POST':
        user, authenticated = User.authenticate(db.session.query, 
                request.form['email'], request.form['password'])
        if authenticated:
            session['user_id'] = user.id
            flash('You were logged in')
            return redirect(url_for('show_entries'))
        else:
            flash('Invalid email or password')
    return render_template('login.html')
Ejemplo n.º 3
0
def login():
	if request.method == 'POST':
		user, authenticated = User.authenticate(db.session.query,
			request.form['user_nm'], request.form['password'])
		if authenticated:
			session['user_id'] = user.id
			flash(u'ログイン完了')
			return redirect(url_for('show_entries'))
		else:
			flash(u'ユーザーかパスワードが違います。')
	return render_template('login.html')
Ejemplo n.º 4
0
def login():
    if request.method == 'POST':
        user = User.authenticate(db.session.query,
                request.form['name'])
        if user != None:
            session['user_id'] = user.id
            flash('You were logged in')
            return redirect(url_for('calendar'))
        else:
            flash('Invalid your name')
    return render_template('login.html')
Ejemplo n.º 5
0
def login():
    form = LoginForm(request.form)
    if form.validate_on_submit():
        user, authenticated = User.authenticate(db.session.query, 
                form.email.data, form.password.data)
        if authenticated:
            session['user_id'] = user.id
            flash('You were logged in')
            return redirect(url_for('index'))
        else:
            flash('Invalid email or password')
    return render_template('login.html', form=form)
Ejemplo n.º 6
0
def login():
    form = LoginForm(request.form)
    if form.validate_on_submit():
        user, authenticated = User.authenticate(db.session.query,
                                                form.email.data,
                                                form.password.data)
        if authenticated:
            session['user_id'] = user.id
            flash('You were logged in')
            return redirect(url_for('index'))
        else:
            flash('Invalid email or password')
    return render_template('login.html', form=form)
Ejemplo n.º 7
0
def login():
    if request.method == 'POST':
        user, authenticated = User.authenticate(db.session.query,
                                                request.form['email'],
                                                request.form['password'])
        projectname = request.form['project']
        if authenticated:
            session['user_id'] = user.id
            flash(projectname + 'にログインしました。')
            return redirect(url_for('show_entries', projectname=projectname))
        else:
            flash('メールアドレスまたはパスワードが正しくありません。')
    return render_template('login.html')