Funcionalidad basica completa. Ahora implementare las vistas.
This commit is contained in:
parent
4d603be09f
commit
f10fe6b81b
@ -21,7 +21,6 @@ Please log in to continue:<br />
|
|||||||
You can Sign out here:
|
You can Sign out here:
|
||||||
<a href="#" onclick="signOut();">Sign out</a>
|
<a href="#" onclick="signOut();">Sign out</a>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -32,45 +31,38 @@ You can Sign out here:
|
|||||||
console.log('Image URL: ' + profile.getImageUrl());
|
console.log('Image URL: ' + profile.getImageUrl());
|
||||||
console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
|
console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
|
||||||
|
|
||||||
var userID = profile.getEmail().substr(0,profile.getEmail().search("@"));
|
postRedirect("/users/add",{
|
||||||
console.log("User ID: " + userID);
|
userEmail : profile.getEmail(),
|
||||||
|
userName : profile.getName(),
|
||||||
|
userImg : profile.getImageUrl(),
|
||||||
|
userRole : "admin",
|
||||||
|
action : "logIn"
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function postRedirect(url, postData){
|
||||||
|
|
||||||
var postForm = document.createElement("form");
|
var postForm = document.createElement("form");
|
||||||
postForm.action = "./users/add";
|
postForm.action = url;
|
||||||
postForm.method = "POST";
|
postForm.method = "POST";
|
||||||
|
|
||||||
var data = document.createElement("input");
|
postForm.style.display = "none";
|
||||||
data.type = "hidden";
|
|
||||||
data.name = "userID";
|
|
||||||
data.value = userID;
|
|
||||||
postForm.appendChild(data);
|
|
||||||
|
|
||||||
data = document.createElement("input");
|
for (var key in postData){
|
||||||
data.type = "hidden";
|
if (postData.hasOwnProperty(key)){
|
||||||
data.name = "userName";
|
var input = document.createElement("input");
|
||||||
data.value = profile.getName();
|
input.type = "hidden";
|
||||||
postForm.appendChild(data);
|
input.name = key;
|
||||||
|
input.value = postData[key];
|
||||||
data = document.createElement("input");
|
postForm.appendChild(input);
|
||||||
data.type = "hidden";
|
}
|
||||||
data.name = "userImg";
|
}
|
||||||
data.value = profile.getImageUrl();
|
|
||||||
postForm.appendChild(data);
|
|
||||||
|
|
||||||
data = document.createElement("input");
|
|
||||||
data.type = "hidden";
|
|
||||||
data.name = "userRole";
|
|
||||||
data.value = "admin";
|
|
||||||
postForm.appendChild(data);
|
|
||||||
|
|
||||||
data = document.createElement("input");
|
|
||||||
data.type = "hidden";
|
|
||||||
data.name = "logIn";
|
|
||||||
data.value = "logIn";
|
|
||||||
postForm.appendChild(data);
|
|
||||||
|
|
||||||
document.body.appendChild(postForm);
|
document.body.appendChild(postForm);
|
||||||
|
|
||||||
postForm.submit();
|
postForm.submit();
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
|
Loading…
Reference in New Issue
Block a user