-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added admin panel to add/remove superusers. Removed superuser option …
…from sign up page.
- Loading branch information
Aisha Saeed
committed
Jul 10, 2018
1 parent
b303f35
commit e089078
Showing
7 changed files
with
271 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
184 changes: 184 additions & 0 deletions
184
omi_security/security_node/templates/superusers_panel.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
|
||
|
||
|
||
<div class="container"> | ||
|
||
|
||
<div class="omb_login"> | ||
<h2 class="omb_authTitle">Admin Panel</h2> | ||
<h3 align="center"><font color="orange">To Add New Superuser</font></h3> | ||
<div class="row omb_row-sm-offset-3 omb_socialButtons"> | ||
|
||
</div> | ||
|
||
<div class="row omb_row-sm-offset-3 omb_loginOr"> | ||
<div class="col-xs-12 col-sm-6"> | ||
<hr class="omb_hrOr"> | ||
</div> | ||
</div> | ||
|
||
<div class="row omb_row-sm-offset-3"> | ||
<div class="col-xs-12 col-sm-6"> | ||
<form class="omb_loginForm" action="" autocomplete="off" method="POST"> | ||
{% csrf_token %} | ||
<div class="input-group"> | ||
<span class="input-group-addon"><i class="fa fa-address-book"></i></span> | ||
<input autofocus="" class="form-control" id="id_first_name" maxlength="64" name="first_name" placeholder="First name" type="text" {% if form.first_name.value %} value="{{form.first_name.value}}" {% endif %} required /> | ||
</div> | ||
<span class="help-block">{{form.errors.first_name}}</span> | ||
|
||
|
||
<div class="input-group"> | ||
<span class="input-group-addon"><i class="fa fa fa-address-book-o"></i></span> | ||
<input autofocus="" class="form-control" id="id_last_name" maxlength="64" name="last_name" placeholder="Last Name" type="text" {% if form.last_name.value %} value="{{form.last_name.value}}" {% endif %} required /> | ||
</div> | ||
<span class="help-block">{{form.errors.last_name}}</span> | ||
|
||
|
||
<div class="input-group"> | ||
<span class="input-group-addon"><i class="fa fa-user-circle-o"></i></span> | ||
<input autofocus="" class="form-control" id="id_username" maxlength="32" minlength="6" name="username" placeholder="Username" type="text" {% if form.username.value %} value="{{form.username.value}}" {% endif %} required /> | ||
</div> | ||
<span class="help-block">{{form.errors.username}}</span> | ||
|
||
|
||
<div class="input-group"> | ||
<span class="input-group-addon"><i class="fa fa-user"></i></span> | ||
<input autofocus="" class="form-control" id="id_email" maxlength="64" name="email" placeholder="Email" type="text" {% if form.email.value %} value="{{form.email.value}}" {% endif %} required /> | ||
</div> | ||
<span class="help-block">{{form.errors.email}}</span> | ||
|
||
|
||
<div class="input-group"> | ||
<span class="input-group-addon"><i class="fa fa-lock"></i></span> | ||
<input class="form-control" id="id_password" maxlength="32" minlength="6" name="password" type="password" placeholder="Password" required /> | ||
</div> | ||
<span class="help-block">{{form.errors.password}}</span> | ||
|
||
|
||
<div class="input-group"> | ||
<span class="input-group-addon"><i class="fa fa-lock"></i></span> | ||
<input class="form-control" id="id_password1" maxlength="32" minlength="6" name="password1" type="password" placeholder="Confirm Password" required /> | ||
</div> | ||
<span class="help-block">{{form.errors.password1}}</span> | ||
|
||
|
||
<div class="input-group"> | ||
<span class="input-group-addon"><i class="fa fa-address-card-o"></i> Check if Superuser</span> | ||
<input autofocus="" class="form-control" id="id_is_superuser" name="is_superuser" type="checkbox" {% if form.is_superuser.value %} value="{{form.is_superuser.value}}" {% endif %} /> | ||
</div> | ||
|
||
<span class="help-block">{{form.non_field_errors.0}}</span> | ||
|
||
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign Up Superuser</button> | ||
</form> | ||
</div> | ||
</div> | ||
|
||
<div class="row omb_row-sm-offset-3"> | ||
<div class="col-xs-12 col-sm-3"> | ||
<label class="checkbox"> | ||
|
||
</label> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<h3 align="center" style="margin-top:50px;"><font color="orange">To Modify Existing User Roles</font></h3> | ||
<table border="1" align="center"> | ||
<tr> | ||
<th>First Name</th> | ||
<th>Last Name</th> | ||
<th>Email</th> | ||
<th>Username</th> | ||
<th>Is_superuser</th> | ||
<th>Change Status</th> | ||
</tr> | ||
|
||
{% for user in list_users %} | ||
<tr> | ||
<td>{{ user.first_name }}</td> | ||
<td>{{ user.last_name }}</td> | ||
<td>{{ user.email }}</td> | ||
<td>{{ user.username }}</td> | ||
<td>{{ user.is_superuser }}</td> | ||
{% if user.is_superuser %} | ||
<td><form method="post" action="/userRole/{{user.id}}/"> | ||
{% csrf_token %} | ||
<input type="hidden" name="user_superuser" value="superuser"> | ||
<input type="submit" value="Downgrade to normal user"></form></td> | ||
|
||
{% else %} | ||
<td><form method="post" action="/userRole/{{user.id}}/"> | ||
{% csrf_token %} | ||
<input type="hidden" name="user_superuser" value="normaluser"> | ||
<input type="submit" value="Upgrade to super user"></form></td> | ||
|
||
{% endif %} | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
|
||
|
||
|
||
</div> | ||
|
||
|
||
|
||
|
||
{% endblock %} | ||
|
||
|
||
<!-- | ||
<table> | ||
<tr> | ||
<th>Username</th> | ||
<th>is_superuser</th> | ||
<th>Enable/disable Superuser</th> | ||
</tr> | ||
<tbody> | ||
{% for user in list_users %} | ||
<tr> | ||
<td>{{ user.username }}</td> | ||
{% if user.is_superuser %} | ||
<td>$ {{ user.is_superuser }}</td> | ||
{% else %} | ||
<td></td> | ||
{% endif %} | ||
<td><a href="url:userRole" user.id>Modify User</a></td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
--> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<h2>Sign up</h2> | ||
<form action="#" method="post"> | ||
{% csrf_token %} | ||
{{ form }} | ||
<input type="submit" value="Sign Up" /> | ||
</form> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters