Ejemplo n.º 1
0
def login():
    if g.user is not None and g.user.is_authenticated():
        # TODO: Already logged in. Move to a default after-login page.
        # For now asks to logout
        return 'Now logged in <a href="logout">Logout</a>'
    form = LoginForm()
    if form.validate_on_submit():
        return oid.try_login(form.openid.data, ask_for = ['nickname', 'email'])
    return render_template('/login.html', form = form)
Ejemplo n.º 2
0
def login():
	"""
	show login page
	"""
	try:
		if request.args.get("openid_identifier") is not None:
			openid = request.args.get("openid_identifier")
			return oid.try_login(openid, ask_for=['email', 'fullname',
												  'nickname', 'language', 'image', 'timezone'])
		else:
			return render_template("login.html", next=oid.get_next_url(), error = oid.fetch_error())
	except TemplateNotFound:
		app.logger.error("template user/login.html not found")
		abort(404)
Ejemplo n.º 3
0
def login():
    if g.user is not None and g.user.is_authenticated():
        return redirect(url_for('home'))

    if request.method == 'POST':
        provider = request.form.get('provider')
        if provider is not None and provider in oid_end_points:
            return oid.try_login(oid_end_points[provider], ask_for=['nickname', 'email'])
        else:
            flash('OpenID provider not found')
            return redirect(url_for('login'))

    return render_template('login.html', next=request.args.get('next', ''),
                           error_code=request.args.get('error_code', ''))
Ejemplo n.º 4
0
def login():
    """
	show login page
	"""
    try:
        if request.args.get("openid_identifier") is not None:
            openid = request.args.get("openid_identifier")
            return oid.try_login(openid,
                                 ask_for=[
                                     'email', 'fullname', 'nickname',
                                     'language', 'image', 'timezone'
                                 ])
        else:
            return render_template("login.html",
                                   next=oid.get_next_url(),
                                   error=oid.fetch_error())
    except TemplateNotFound:
        app.logger.error("template user/login.html not found")
        abort(404)