<%namespace name="base" file="/base/base.mako"/>

${base.gravatar_with_user(c.user.username, 16, tooltip=False, _class='pull-left')}  - ${_('Authentication Tokens')}

${_('Authentication tokens can be used to interact with the API, or VCS-over-http. ' 'Each token can have a role. Token with a role can be used only in given context, ' 'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')}

%if c.user_auth_tokens: %for auth_token in c.user_auth_tokens: %endfor %else: %endif
${_('Token')} ${_('Description')} ${_('Role')} ${_('Repository Scope')} ${_('Expiration')} ${_('Action')}
${auth_token.api_key}
${auth_token.description} ${auth_token.role_humanized} ${auth_token.scope_humanized} %if auth_token.expires == -1: ${_('never')} %else: %if auth_token.expired: ${h.age_component(h.time_to_utcdatetime(auth_token.expires))} %else: ${h.age_component(h.time_to_utcdatetime(auth_token.expires))} %endif %endif ${h.secure_form(h.route_path('edit_user_auth_tokens_delete', user_id=c.user.user_id), request=request)} ${h.hidden('del_auth_token', auth_token.user_api_key_id)} ${h.end_form()}
${_('No additional auth tokens specified')}
${h.secure_form(h.route_path('edit_user_auth_tokens_add', user_id=c.user.user_id), request=request)}
${h.text('description', class_='medium', placeholder=_('Description'))} ${h.hidden('lifetime')} ${h.select('role', '', c.role_options)} % if c.allow_scoped_tokens: ${h.hidden('scope_repo_id')} % else: ${h.select('scope_repo_id_disabled', '', ['Scopes available in EE edition'], disabled='disabled')} % endif

${_('Repository scope works only with tokens with VCS type.')}

${h.submit('save',_('Add'),class_="btn")} ${h.reset('reset',_('Reset'),class_="btn")}
${h.end_form()}