add admin register
This commit is contained in:
parent
85cc2ef8f8
commit
1207d4a8c4
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.communication.HttpRequester;
|
||||
import org.bench4q.share.communication.HttpRequester.HttpResponse;
|
||||
|
@ -19,6 +20,7 @@ import org.bench4q.web.model.TestPlanTaskModel;
|
|||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
|
@ -54,14 +56,19 @@ public class AuthorizeActionController extends BaseControllerService {
|
|||
|
||||
@RequestMapping("register")
|
||||
@ResponseBody
|
||||
public BaseResponseModel register(UserModel user)
|
||||
throws CustomGenericException {
|
||||
System.out.println("enter register!!");
|
||||
public BaseResponseModel register(@RequestParam String userName,
|
||||
@RequestParam String password,
|
||||
@RequestParam String scope) throws CustomGenericException {
|
||||
UserModel user = new UserModel();
|
||||
user.setUserName(userName);
|
||||
user.setPassword(password);
|
||||
isValidate(user);
|
||||
Map<String, String> params = this.makeParamsMap("userName",
|
||||
user.getUserName());
|
||||
params.put("password", user.getPassword());
|
||||
params.put("scope", scope);
|
||||
try {
|
||||
|
||||
HttpResponse httpResponse = this.getHttpRequester().sendGet(
|
||||
baseUrl + "/register", params, null);
|
||||
if (HttpRequester.isInvalidResponse(httpResponse)) {
|
||||
|
|
|
@ -38,5 +38,5 @@ input {
|
|||
|
||||
.submitDiv {
|
||||
float: left;
|
||||
margin-right: 50px;
|
||||
margin-right: 10px;
|
||||
}
|
|
@ -77,7 +77,14 @@
|
|||
src="images/submit.jpg"
|
||||
onMouseOver="this.src='images/submiton.jpg'"
|
||||
onMouseOut="this.src='images/submit.jpg'"
|
||||
onClick="javascript:password_validation();return false" />
|
||||
onClick="javascript:password_validation(0);return false" />
|
||||
</div>
|
||||
<div class="submitDiv">
|
||||
<input type="image" name="Submit" value="Register"
|
||||
src="images/submit.jpg"
|
||||
onMouseOver="this.src='images/submiton.jpg'"
|
||||
onMouseOut="this.src='images/submit.jpg'"
|
||||
onClick="javascript:password_validation(1);return false" />
|
||||
</div>
|
||||
<div class="submitDiv">
|
||||
<img name="Clear" src="images/clear.jpg"
|
||||
|
|
|
@ -28,14 +28,15 @@ function clean() {
|
|||
document.getElementsByName('password')[0].value = "";
|
||||
document.getElementsByName('retype_pwd')[0].value = "";
|
||||
}
|
||||
function register() {
|
||||
function register(scope) {
|
||||
alert(scope)
|
||||
var userName = $('#username').val();
|
||||
var password = $('#password').val();
|
||||
var rePassword = $("#retype_pwd").val();
|
||||
$.post('register', {
|
||||
userName : userName,
|
||||
password : password,
|
||||
rePassword : rePassword
|
||||
scope:scope
|
||||
}, function(data) {
|
||||
if (data.success) {
|
||||
window.location.replace("registerSuccess.jsp");
|
||||
|
@ -46,7 +47,7 @@ function register() {
|
|||
}, "json");
|
||||
}
|
||||
|
||||
function password_validation() {
|
||||
function password_validation(scope) {
|
||||
var null_flag = 0;
|
||||
var user_name = document.getElementsByName('username')[0].value;
|
||||
var retype_pwd = document.getElementsByName('retype_pwd')[0].value;
|
||||
|
@ -81,5 +82,5 @@ function password_validation() {
|
|||
document.getElementsByName('retype_pwd')[0].style.border = "";
|
||||
}
|
||||
if (null_flag == 0)
|
||||
register();
|
||||
register(scope);
|
||||
}
|
Loading…
Reference in New Issue