Added link to open a new Renkan from mock GED client
authordurandn
Wed, 17 Feb 2016 11:25:20 +0100
changeset 3 3f52a017e6f5
parent 2 d5c583f9a035
child 4 8bc8b208441d
Added link to open a new Renkan from mock GED client
oauth/client.py
oauth/templates/client/index.html
--- a/oauth/client.py	Tue Feb 16 15:46:00 2016 +0100
+++ b/oauth/client.py	Wed Feb 17 11:25:20 2016 +0100
@@ -1,4 +1,4 @@
-from flask import Flask, url_for, session, request, jsonify
+from flask import Flask, url_for, session, request, jsonify, render_template, redirect
 from flask_oauthlib.client import OAuth
 from settings.client_settings import ClientSettings
 
@@ -26,7 +26,8 @@
 def index():
     if 'remote_oauth' in session:
         resp = remote.get('me')
-        return jsonify(resp.data)
+        username = resp.data.get("username", "")
+        return render_template('client/index.html', username=username)
     next_url = request.args.get('next') or request.referrer or None
     return remote.authorize(
         callback=url_for('authorized', next=next_url, _external=True)
@@ -43,7 +44,7 @@
         )
     print resp
     session['remote_oauth'] = (resp['access_token'], '')
-    return jsonify(oauth_token=resp['access_token'])
+    return redirect('/')
 
 
 @remote.tokengetter
--- a/oauth/templates/client/index.html	Tue Feb 16 15:46:00 2016 +0100
+++ b/oauth/templates/client/index.html	Wed Feb 17 11:25:20 2016 +0100
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title></title>
+</head>
+<body>
+  <h4>Mock GED client</h4>
+  <p>You are: {{ username }}</p>
+  <p>Create a <a href="{{ config['CREATE_RENKAN_URL'] }}">new Renkan</a></p>
+</body>
+</html>
\ No newline at end of file