blob: 429558608247cb146452d099f0dbbbbb2917c54e [file] [log] [blame]
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Registration</title>
<script type="text/javascript" src="../js/constants.js"></script>
<script type="text/javascript" src="../dojo/dojo.js"></script>
<script type="text/javascript">
function populateInfo() {
dojo.xhrPost({
url:"../security", //photark.constants.SecurityEndpoint,
content:{request:"getUserInfo"},
sync:true,
handleAs: "json",
load: function(response, ioArgs) {
if (response.registered == "false" && response.user.userId != "null" && response.user.userId != "SuperAdmin") {
document.getElementById('userId').innerHTML = "" + response.user.userId;
document.getElementById('realName').value = response.user.userInfo.realName;
document.getElementById('displayName').value = response.user.userInfo.displayName;
document.getElementById('email').value = response.user.userInfo.email;
document.getElementById('webSite').value = response.user.userInfo.website;
} else {
window.location = "/photark/home/authenticate";
}
},
error: function(response, ioArgs) {
console.error("Error in getting user info");
logout();
}
});
}
function init() {
try {
dojo.addOnLoad(function() {
dojo.require("dojo._base.xhr");
populateInfo();
});
} catch (e) {
alert(e);
}
}
function save() {
if (document.getElementById('displayName').value != null && trimAll(document.getElementById('displayName').value) != "") {
set();
} else {
document.getElementById('displayName').style.borderColor = "red";
alert("Please enter a \"Display Name\"!");
document.getElementById('displayName').focus();
}
}
function trimAll(sString) {
while (sString.substring(0, 1) == ' ') {
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length - 1, sString.length) == ' ') {
sString = sString.substring(0, sString.length - 1);
}
return sString;
}
function set() {
dojo.xhrPost({
url:"../security", //photark.constants.SecurityEndpoint,
content:{request:"setUserInfo",
realName:document.getElementById('realName').value,
displayName:document.getElementById('displayName').value,
email:document.getElementById('email').value,
webSite:document.getElementById('webSite').value},
handleAs: "text",
load: function(response, ioArgs) {
if (response == "OK") {
window.location = "/photark/home/authenticate"
}
},
error: function(response, ioArgs) {
console.error("Error in getting user info");
logout();
}
});
}
function securityLogout() {
window.location = "../logout";
}
</script>
<style type="text/css">
#container {
padding: 1em;
}
#container p {
font-size: 1.2em;
font-family: Tahoma, Verdana;
}
</style>
</head>
<body onload="init()">
<div id="container" style="margin-left:5px">
<div style="float:right;width:50%;font-size:0.7em;text-align:right;">
<div><span><a href="../logout">Gallery</a></span></div>
</div>
<p>Get <span style="color:orange">registered</span> with PhotArk</p>
<table border="0">
<tr>
<td>OpenID :</td>
<td>
<div id="userId" style="color:green;"></div>
</td>
</tr>
<tr>
<td><span>Display Name </span><span style="color:red">*</span><span> : </span></td>
<td><label>
<input id="displayName" type="text" name="displayName" size="20"/>
</label></td>
</tr>
<tr>
<td>Real Name :</td>
<td><label>
<input id="realName" type="text" name="realName" size="35"/>
</label></td>
</tr>
<tr>
<td>E-mail :</td>
<td><label>
<input id="email" type="text" name="email" size="35"/>
</label></td>
</tr>
<tr>
<td>Website :</td>
<td><label>
<input id="webSite" type="text" name="webSite" size="35"/>
</label></td>
</tr>
<tr>
</tr>
<tr>
<td>
</td>
<td>
<button id="submit" type="button" onclick="save()" style="margin-right:5px">Register</button>
<button id="cancel" type="button" onclick="securityLogout()">Cancel</button>
</td>
</tr>
</table>
</div>
</body>
</html>