UNPKG

auth-center

Version:
104 lines (102 loc) 3.54 kB
{% extends './layout.html' %} {% block head %} <title>Clients</title> {% endblock %} {% block content %} {% if messages.success %} <div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button> {{messages.success}} </div> {% endif %} {% if messages.error %} <div class="alert alert-warning"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button> {{messages.error}} </div> {% endif %} <div class="clearfix mb-3"> <button type="button" class="btn btn-success float-right" data-toggle="modal" data-target="#clientModal"> Add Client </button> <form action="?" class="form-inline" method="GET"> <div class="form-group mr-sm-2"> <input type="text" name="q" value="{{query}}" class="form-control" style="width: 200px;" placeholder="Name"> </div> <button type="submit" class="btn btn-primary">Search</button> </form> </div> <table class="table"> <thead> <tr> <th>Name</th> <th>ID</th> <th>Secret</th> <th>Redirect URI</th> <th>Operation</th> </tr> </thead> <tbody> {% if clients.rows.length == 0 %} <tr> <td colspan="5" class="text-center">No data available in table</td> </tr> {% else %} {% for d in clients.rows %} <tr> <td> {{d.name}}<br> <span class="text-muted">{{d.name_cn}}</span> </td> <td>{{d.id}}</td> <td>{{d.secret}}</td> <td>{{d.redirect_uri}}</td> <td> <form action="{{_routes.admin.generate_secret}}" method="post"> <input type="hidden" name="_csrf" value="{{_csrf}}"> <input type="hidden" name="id" value="{{d.id}}"> <button class="btn btn-primary btn-sm" type="submit">Generate</button> </form> </td> </tr> {% endfor %} {% endif %} </tbody> </table> <nav> {{pagination(page, total, link) | safe}} </nav> <div class="modal fade" id="clientModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="myModalLabel">Add New Client</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <form action="{{_routes.admin.add_client}}" method="post"> <input type="hidden" name="_csrf" value="{{_csrf}}"> <div class="modal-body"> <div class="form-group"> <label for="recipient-name" class="control-label">Name</label> <input type="text" class="form-control" name="name"> </div> <div class="form-group"> <label for="recipient-name" class="control-label">Name CN</label> <input type="text" class="form-control" name="name_cn"> </div> <div class="form-group"> <label for="recipient-name" class="control-label">Redirect URI</label> <input type="text" class="form-control" name="redirect_uri"> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> <button type="submit" class="btn btn-primary">Submit</button> </div> </form> </div> </div> </div> {% endblock %}