Changeset - 2eccba069825
[Not reviewed]
0 2 0
Jan Kaluza - 9 years ago 2016-02-10 18:50:11
jkaluza@redhat.com
Web interface: show warning when trying to register already registered username
2 files changed with 12 insertions and 8 deletions:
0 comments (0 inline, 0 general)
spectrum_manager/src/html/js/app.js
Show inline comments
 
@@ -194,25 +194,29 @@ function fill_instances_register_form() {
 
	});
 
}
 

	
 
function fill_users_register_form() {
 
	$(".button").click(function(e) {
 
		e.preventDefault();
 
		$(this).parent().empty().progressbar( {value: false} ).css('height', '1em');
 

	
 
		var postdata ={
 
			"username": $("#username").val(),
 
			"password": $("#password").val()
 
		};
 

	
 
		$.post($.cookie("base_location") + "api/v1/users/add", postdata, function(data) {
 
			var query = getQueryParams(document.location.search);
 
			if (query.back_to_list == "1") {
 
				window.location.replace("list.shtml");
 
		$.post("/api/v1/users/add", postdata, function(data) {
 
			if (data.error) {
 
				$('#error').text(data.message);
 
			}
 
			else {
 
				window.location.replace("../login/");
 
				var query = getQueryParams(document.location.search);
 
				if (query.back_to_list == "1") {
 
					window.location.replace("list.shtml");
 
				}
 
				else {
 
					window.location.replace("../login/");
 
				}
 
			}
 
		});
 
	})
 
}
 

	
spectrum_manager/src/html/users/register.shtml
Show inline comments
 
<!--#include virtual="/header.shtml" -->
 

	
 
<h2>Register new Spectrum 2 manager account</h2>
 

	
 
<div id="error" style="text-align:center;color:red;"></div>
 
<form action="/api/v1/users/add" class="basic-grey" method="POST"> 
 
	<h1>Register user 
 
		<span>Register new user to Spectrum 2 manager web interface.</span> 
 
	</h1> 
 
	<label> 
 
		<span>Username:</span> 
 
		<input type="text" id="username" name="username" placeholder="Username"></textarea> 
 
	</label> 
 
	<label><span>Password:</span> 
 
		<input type="password" id="password" name="password" placeholder="Password"></textarea> 
 
	</label> 
 
	<label> 
 
	<label id="submitbutton">
 
		<span>&nbsp;</span> 
 
		<input type="submit" class="button" value="Add user" />
 
	</label> 
 
</form><br/>
 

	
 
<script type="text/javascript">
0 comments (0 inline, 0 general)