You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2014/06/04 22:52:04 UTC

[05/16] git commit: [#1687] ticket:574 Remove oauth tokens from preferences

[#1687] ticket:574 Remove oauth tokens from preferences


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/65cc6e78
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/65cc6e78
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/65cc6e78

Branch: refs/heads/master
Commit: 65cc6e789d69ed33251071727940b793cf350082
Parents: cf55cdd
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Apr 28 12:07:11 2014 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Jun 3 15:27:21 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py       | 25 +------------------------
 Allura/allura/templates/user_prefs.html | 23 -----------------------
 2 files changed, 1 insertion(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/65cc6e78/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index c25e33e..ff2d42f 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -341,11 +341,7 @@ class PreferencesController(BaseController):
     def index(self, **kw):
         provider = plugin.AuthenticationProvider.get(request)
         menu = provider.account_navigation()
-        api_token = M.ApiToken.query.get(user_id=c.user._id)
-        return dict(
-            menu=menu,
-            api_token=api_token,
-        )
+        return dict(menu=menu)
 
     @h.vardec
     @expose()
@@ -392,25 +388,6 @@ class PreferencesController(BaseController):
 
     @expose()
     @require_post()
-    def gen_api_token(self):
-        tok = M.ApiToken.query.get(user_id=c.user._id)
-        if tok is None:
-            tok = M.ApiToken(user_id=c.user._id)
-        else:
-            tok.secret_key = h.cryptographic_nonce()
-        redirect(request.referer)
-
-    @expose()
-    @require_post()
-    def del_api_token(self):
-        tok = M.ApiToken.query.get(user_id=c.user._id)
-        if tok is None:
-            return
-        tok.delete()
-        redirect(request.referer)
-
-    @expose()
-    @require_post()
     @validate(V.NullValidator(), error_handler=index)
     def change_password(self, **kw):
         kw = g.theme.password_change_form.to_python(kw, None)

http://git-wip-us.apache.org/repos/asf/allura/blob/65cc6e78/Allura/allura/templates/user_prefs.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/user_prefs.html b/Allura/allura/templates/user_prefs.html
index 25d1120..fbf47d8 100644
--- a/Allura/allura/templates/user_prefs.html
+++ b/Allura/allura/templates/user_prefs.html
@@ -106,29 +106,6 @@
   </div>
   {% endif %}
 
-  {% if tg.config.get('auth.method', 'local') == 'local' %}
-  <div class="grid-20">
-      <h2>API Token</h2>
-      {% if api_token %}
-        <p>
-          <b>API Key:</b><br/>
-          {{api_token.api_key}}<br/>
-          <b>Secret Key:</b><br/>
-          {{api_token.secret_key}}<br/>
-        </p>
-        <form method="POST" action="del_api_token" class="grid-18">
-          <input type="submit" value="Delete API Token">
-          {{lib.csrf_token()}}
-        </form>
-      {% else %}
-        <p>No API token generated</p>
-      {% endif %}
-      <form method="POST" action="gen_api_token" class="grid-18">
-        <input type="submit" value="(Re)generate API Token">
-        {{lib.csrf_token()}}
-      </form>
-  </div>
-  {% endif %}
 <div class="grid-20">
     <h2>User Messages</h2>
     <form method="POST" action="user_message">