我正在使用Google App Engine(Python)並使用OpenID進行登錄。具體來說,我與GitHub的項目打從「metachris」在這裏:https://github.com/metachris/appengine-boilerplateAppEngine - 嘗試在OpenID登錄後重定向到新頁面
我相信代碼中的相關部分(應用處理器用於登錄)在這裏:
class LogIn(webapp.RequestHandler):
def get(self):
user = users.get_current_user()
action = decode(self.request.get('action'))
target_url = decode(self.request.get('continue'))
if action and action == "verify":
f = decode(self.request.get('openid_identifier'))
url = users.create_login_url(target_url, federated_identity=f)
self.redirect(url)
else:
self.response.out.write(template.render(tdir + "login.html", \
{"continue_to": target_url}))
而且login.html的代碼包括:
<!-- Simple OpenID Selector -->
<form action="/login" method="get" id="openid_form">
<input type="hidden" name="action" value="verify" />
{% if continue_to %}<input type="hidden" name="continue" value="{{ continue_to }}" />{% endif %}
<fieldset>
<legend>Sign-in or Create New Account</legend>
<div id="openid_choice">
<p>Please click your account provider:</p>
<div id="openid_btns"></div>
</div>
<div id="openid_input_area">
<input id="openid_identifier" name="openid_identifier" type="text" value="http://" />
<input id="openid_submit" type="submit" value="Sign-In"/>
</div>
</fieldset>
</form>
<!-- /Simple OpenID Selector -->
現在,登錄應用程序後,人們會回到根頁面。我想將它們帶到登錄用戶的新主頁。我嘗試了不同的一堆參數,但我沒有得到它的工作。
任何人都可以指出我哪裏錯了嗎?
謝謝,丹。這正是我所需要的,而且很有效!你提到的'驗證'被設置並自動進入'登錄'似乎沒有工作,但這是以後的日子。我需要首先將主屏幕拼湊在一起。 – 2011-06-13 00:14:36