Commit 9d305ff Display error message on empty submission in new token page

2 files Authored and Committed by cep 11 months ago
Display error message on empty submission in new token page

    
 1 @@ -37,8 +37,8 @@
 2             </table>
 3             <div class="p-t-2">
 4               <input type="submit" class="btn btn-primary" value="Create">
 5 -             <input type="button" value="Cancel" class="btn btn-secondary"
 6 -              onclick="history.back();">
 7 +             <a class="btn btn-secondary" href="{{ url_for('.view_settings',
 8 +                 username=username, repo=repo.name, namespace=repo.namespace) }}">Cancel</a>
 9               {{ form.csrf_token }}
10             </div>
11           </form>
 1 @@ -1805,6 +1805,10 @@
 2               APP.logger.exception(err)
 3               flask.flash('User could not be added', 'error')
 4   
 5 +     # When form is displayed after an empty submission, show an error.
 6 +     if form.errors.get('acls'):
 7 +         flask.flash('You must select atleast one permission.', 'error')
 8 + 
 9       return flask.render_template(
10           'add_token.html',
11           select='settings',