[PATCH 4/5] views: Provide a way to view, (re)generate tokens

Stephen Finucane stephen at that.guru
Wed Jun 14 18:58:58 AEST 2017


On Wed, 2017-06-14 at 09:45 +0100, Stephen Finucane wrote:
> On Wed, 2017-06-14 at 17:57 +1000, Daniel Axtens wrote:
> > Daniel Axtens <dja at axtens.net> writes:
> > 
> > > Hi Stephen and Andrew,
> > > 
> > > I've installed this on py[23].patchwork.dja.id.au
> > > 
> > > > diff --git a/htdocs/css/style.css b/htdocs/css/style.css
> > > > index 5218f6d..af2f073 100644
> > > > --- a/htdocs/css/style.css
> > > > +++ b/htdocs/css/style.css
> > > > @@ -369,7 +369,6 @@ table.form th.headerrow {
> > > >  }
> > > >  
> > > >  table.form th {
> > > > -	font-weight: normal;
> > > 
> > > What does this change?
> 
> It changes the 'API Token:' label on '/user'. I wasn't able to see any other
> side-effects.
> 
> > > 
> > > >  	text-align: left;
> > > >  	vertical-align: top;
> > > >  	padding-top: 0.6em;
> > > > diff --git a/patchwork/templates/patchwork/profile.html
> > > > b/patchwork/templates/patchwork/profile.html
> > > > index f976195..2005687 100644
> > > > --- a/patchwork/templates/patchwork/profile.html
> > > > +++ b/patchwork/templates/patchwork/profile.html
> > > > @@ -134,7 +134,35 @@ address.</p>
> > > >  
> > > >  <div class="box">
> > > >  <h2>Authentication</h2>
> > > > -<a href="{% url 'password_change' %}">Change password</a>
> > > > +
> > > > +<table class="form">
> > > > + <tr>
> > > > +  <th>Password:</th>
> > > > +  <td><a href="{% url 'password_change' %}">Change password</a>
> > > > + </tr>
> > > > + <tr>
> > > > +  <th>API Token:</th>
> > > > +  <td>
> > > > +   {% if api_token %}
> > > > +   <input id="token" style="width: 25em;" readonly value="{{ api_token
> > > > }}">
> > > > +   <button type="button" class="btn-copy" title="Copy to clipboard"
> > > > +    data-clipboard-target="#token">Copy</button>
> > > 
> > > This doesn't work for me in Chrome:
> > > 
> > > Uncaught ReferenceError: Clipboard is not defined
> > >     at HTMLDocument.<anonymous> (py3.patchwork.dja.id.au/:26)
> > >     at c (jquery-1.10.1.min.js:4)
> > >     at Object.fireWith [as resolveWith] (jquery-1.10.1.min.js:4)
> > >     at Function.ready (jquery-1.10.1.min.js:4)
> > >     at HTMLDocument.q (jquery-1.10.1.min.js:4)
> > 
> > Ah, this would be due to me forgetting to run collectstatic.
> > 
> > But even when I do that, I still get errors from a broken
> > 
> > clipboard.min.js:
> > Uncaught SyntaxError: Unexpected end of input
> > 
> > Any thoughts?
> 
> I copied and pasted [1] to [2] and it looks like that file isn't complete. I
> suspect this was
> because it exceeded the 998 character SMTP limit (I ignored that error for
> git-send-email :)) Can
> you either (a) download clipboard.min.js from the original site [3], (b)
> clone the version I have
> pushed to my working repo [4], or (c) wait for the next rc which I'll be
> pushing imminently. 
> Any of these should resolve the issue.
> 
> > Regards,
> > Daniel
> > > 
> > > The rest seems to work fine, I can create and use tokens (as far as I
> > > can tell - I haven't tried to do anything with the permissions they
> > > grant.)
> > > 
> > > > +   {% endif %}
> > > > +  </td>
> > > > + <tr>
> > > > +  <th></th>
> > > > +  <td>
> > > > +   <form method="post" action="{%url 'generate_token' %}">
> > > 
> > > That should probably be "{% url" -- a space between % and url.
> 
> I don't think it matters, but I've fixed it in the pushed version.

This is applied now.

Stephen


More information about the Patchwork mailing list