Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend modifications for timestamp based first time signup #388

Merged
merged 59 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
048c569
Fixed typo for return
Vedant1202 Apr 5, 2020
61661f6
merge fix
Vedant1202 Apr 7, 2020
85c4997
Fix for refresh during first slide upload
Vedant1202 Apr 7, 2020
6979fa8
Fixed refresh on first slide upload
Vedant1202 Apr 7, 2020
50b2cc8
Added space after 'if' for eslint configuration
Vedant1202 Apr 7, 2020
1e94b81
Added functionality to delete slide from system
Vedant1202 Apr 7, 2020
8f1c7f6
Merge branch 'develop' of https://github.com/Vedant1202/caMicroscope …
Vedant1202 Apr 7, 2020
31460c7
Removed refresh on first slide upload
Vedant1202 Apr 7, 2020
9f2438a
Added alert for slide deletion success
Vedant1202 Apr 7, 2020
e8bbcd8
Update to fix linting errors
Vedant1202 Apr 7, 2020
b0cef11
Update to fix linting errors
Vedant1202 Apr 7, 2020
4e2bf41
Fix linting errors
Vedant1202 Apr 7, 2020
37fd15c
Fix lint errors
Vedant1202 Apr 7, 2020
7bbc144
Fix lint error
Vedant1202 Apr 7, 2020
27b5299
Rechained promises to handle mishandled slide deletions
Vedant1202 Apr 8, 2020
8477ee6
Merge fix
Vedant1202 Apr 8, 2020
2d805a8
Merge fix
Vedant1202 Apr 8, 2020
3411a5d
style fix
birm Apr 11, 2020
be0480c
Added delete slide request functionality
Vedant1202 Apr 11, 2020
59cc361
Merge branch 'develop' of https://github.com/camicroscope/caMicroscop…
Vedant1202 Apr 11, 2020
0c9e74d
merge fix
Vedant1202 Apr 11, 2020
31763f3
style fix
Vedant1202 Apr 11, 2020
51f6552
style fix
Vedant1202 Apr 11, 2020
554e5c5
style fix
Vedant1202 Apr 11, 2020
0ce49cc
style fix
Vedant1202 Apr 11, 2020
2055317
style fix
Vedant1202 Apr 11, 2020
b5082cc
Merge branch 'develop' into develop
Vedant1202 Apr 12, 2020
a51c0a2
Client side changes for handling new 'requests' collection
Vedant1202 Apr 12, 2020
0f67e0a
merge fix
Vedant1202 Apr 15, 2020
0157d35
merge fix
Vedant1202 Apr 15, 2020
9470c65
merge fix
Vedant1202 Apr 15, 2020
07c0c0c
Fix for direct deletion of slides
Vedant1202 Apr 15, 2020
b1689c4
style fix
Vedant1202 Apr 15, 2020
45a187d
Added feature for user registration requests
Vedant1202 Apr 16, 2020
7de0148
merge fix
Vedant1202 Apr 16, 2020
302af9d
Merge branch 'develop' of https://github.com/Vedant1202/caMicroscope …
Vedant1202 Apr 16, 2020
adc9c16
style fix
Vedant1202 Apr 16, 2020
5612529
Commented line stating that signup page is just for admins
Vedant1202 Apr 16, 2020
ca8919d
Added line explaining new workflow of signup page
Vedant1202 Apr 16, 2020
2076b0c
Merge branch 'develop' into develop
Vedant1202 Apr 17, 2020
03f00c9
Added popups for success instead of alerts and moved showSuccessPopup…
Vedant1202 Apr 17, 2020
14195ce
Comment fix
Vedant1202 Apr 17, 2020
e801362
Style fix
Vedant1202 Apr 17, 2020
0c2b5ac
Merge branch 'develop' of https://github.com/camicroscope/caMicroscop…
Vedant1202 Apr 17, 2020
d3ca2e2
Merge branch 'develop' of https://github.com/camicroscope/caMicroscop…
Vedant1202 Apr 17, 2020
7e8d644
Solved permsisions is not defined error in signup.html
Vedant1202 Apr 17, 2020
2cd0aef
Merge branch 'develop' of https://github.com/Vedant1202/caMicroscope …
Vedant1202 Apr 17, 2020
e89ec80
Comment fix
Vedant1202 Apr 17, 2020
d3fd9ab
catch promise error
Vedant1202 Apr 17, 2020
e2924e7
error handling on fetching requests
Vedant1202 Apr 17, 2020
46849bd
Merge branch 'develop' into develop
birm Apr 17, 2020
52d9ac1
Update apps/table.html
birm Apr 17, 2020
602d459
modifications for handling prototype
Vedant1202 Apr 19, 2020
bf87da7
removed unwanted console.logs
Vedant1202 Apr 19, 2020
d76c259
merge fix
Vedant1202 Apr 19, 2020
636c41e
Merge branch 'develop' of https://github.com/Vedant1202/caMicroscope …
Vedant1202 Apr 19, 2020
aa4b596
Merge branch 'develop' of https://github.com/camicroscope/caMicroscop…
Vedant1202 Apr 25, 2020
c08aa06
Update functions to handle first time user registrations
Vedant1202 Apr 25, 2020
f22e1a2
Fix to a missing .html extension
Vedant1202 Apr 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 77 additions & 30 deletions apps/signup/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@

</head>
<script>
var userSignupUrl = "../../data/User/post"
var userSignupUrl = "../../data/User/post";
var protoTokenUrl = "../../auth/Token/proto";
var permissions;

function addUser(){
Expand All @@ -52,34 +53,80 @@
if (attr == "2"){
userType = "Editor"
}
// if (getUserType() === "Admin") {
if (permissions.user.post == true) {
var doc = {email: email, userType: userType, userFilter:filters}
fetch(userSignupUrl, {
method: 'POST',
mode: 'cors', // no-cors, cors, *same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(doc),
}).then(x=>{
if (x.status>=400){
throw "failed to sign up user"
}
x.json()
}).then(x=>{
window.alert("User registered successfully")
console.log(x)
}).catch(e=>{
// window.alert("error!")
console.error(e)
});
} else {
const store = new Store('../data/');
store.requestToCreateUser(email, filters, userType);
}

getUserPermissions(getUserType())
.then(response => response.text())
.then((data) => {
return (data ? JSON.parse(data) : null);
})
.then((data)=> {
if(data===null)
return;
permissions = data;
return;
})
.then((resp) => {
return fetch(protoTokenUrl)
})
.then((response) => {
// console.log(response);
return response.json();
})
.then((data) => {
return data.exists
})
.then((x) => {
if (x) {
var doc = {email: email, userType: userType, userFilter:filters}
fetch(userSignupUrl, {
method: 'POST',
mode: 'cors', // no-cors, cors, *same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(doc),
}).then(x=>{
if (x.status>=400){
throw "failed to sign up user"
}
x.json()
}).then(x=>{
window.alert("User registered successfully")
}).catch(e=>{
// window.alert("error!")
console.error(e)
});
} else {
if (permissions.user && permissions.user.post == true) {
var doc = {email: email, userType: userType, userFilter:filters}
fetch(userSignupUrl, {
method: 'POST',
mode: 'cors', // no-cors, cors, *same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(doc),
}).then(x=>{
if (x.status>=400){
throw "failed to sign up user"
}
x.json()
}).then(x=>{
window.alert("User registered successfully");
}).catch(e=>{
// window.alert("error!")
console.error(e)
});
} else {
const store = new Store('../data/');
store.requestToCreateUser(email, filters, userType);
}
}
});
}

$(window).on('load', function() {
Expand All @@ -95,7 +142,7 @@
if(data===null)
return;
permissions = data;
})
});
});

</script>
Expand Down
2 changes: 1 addition & 1 deletion apps/table.css
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,4 @@ nav li:not(.active):hover a{

.collapse.in {
display: inline !important;
}
}
2 changes: 1 addition & 1 deletion login.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
window.location = state
} else {
window.alert("User not added")
window.location = "./apps/signup/signup"
window.location = "./apps/signup/signup.html"
}

})
Expand Down