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

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

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