/* most styles borrowed from
https://codepen.io/Lewitje/pen/BNNJjo?q=login&order=popularity&depth=everything&show_forks=false
*/
@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300);
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0;
padding: 0;
font-weight: 300;
}
body {
font-family: 'Source Sans Pro', sans-serif;
color: white;
font-weight: 300;
}
body ::-webkit-input-placeholder {
/* WebKit browsers */
font-family: 'Source Sans Pro', sans-serif;
color: white;
font-weight: 300;
}
body :-moz-placeholder {
/* Mozilla Firefox 4 to 18 */
font-family: 'Source Sans Pro', sans-serif;
color: white;
opacity: 1;
font-weight: 300;
}
body ::-moz-placeholder {
/* Mozilla Firefox 19+ */
font-family: 'Source Sans Pro', sans-serif;
color: white;
opacity: 1;
font-weight: 300;
}
body :-ms-input-placeholder {
/* Internet Explorer 10+ */
font-family: 'Source Sans Pro', sans-serif;
color: white;
font-weight: 300;
}
.wrapper {
background: #50a3a2;
background: -webkit-gradient(linear, left top, right bottom, from(#50a3a2), to(#53e3a6));
background: linear-gradient(to bottom right, #50a3a2 0%, #53e3a6 100%);
position: absolute;
top: 50%;
left: 0;
width: 100%;
height: 450px;
margin-top: -200px;
overflow: hidden;
}
.wrapper.form-success .container h1 {
-webkit-transform: translateY(85px);
transform: translateY(85px);
}
.container {
max-width: 600px;
margin: 0 auto;
padding: 80px 0;
height: 400px;
text-align: center;
}
.container h1 {
font-size: 40px;
-webkit-transition-duration: 1s;
transition-duration: 1s;
-webkit-transition-timing-function: ease-in-put;
transition-timing-function: ease-in-put;
font-weight: 200;
}
form {
padding: 20px 0;
position: relative;
z-index: 2;
}
form input {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
outline: 0;
border: 1px solid rgba(255,...
JavaScript
var client = Kinvey.init({
appKey: 'kid_rk7NMn57z',
appSecret: '3ecc483bd0864882b0c69965030961c6'
});
const heroRoleId = '0278b7bf-749f-453f-9b74-4a0b2afcfcff',
villainRoleId = '1707214d-5c2f-436c-82d4-6e198749251d';
// for the sake of simplicity in a sample app, I am always logging the current active user out when the page is loaded
var promise = Kinvey.User.logout();
// sign up a new user with Kinvey authentication
document.getElementById('signup-button').addEventListener('click', function(event) {
// If you want to validate these inputs before sending them to the backend you should do that here
var user = new Kinvey.User();
var promise = user.signup({
username: document.getElementById('email').value,
password: document.getElementById('password').value
})
.then(function(user) {
loginSuccess();
console.log(user);
})
.catch(function(error) {
// for the sake of simplicity, I'm just displaying any errors that the API sends me back
document.getElementById('error').innerHTML = error.message;
});
});
// login using the Kinvey authentication
document.getElementById('login-button').addEventListener('click', function(event) {
var user = new Kinvey.User();
var promise = user.login({
username: document.getElementById('email').value,
password: document.getElementById('password').value
})
.then(function(user) {
loginSuccess();
console.log(user);
})
.catch(function(error) {
document.getElementById('error').innerHTML = error.message;
});
});
// sign up or log in with Google authentication
document.getElementById('google-login').addEventListener('click', function(event) {
var promise = Kinvey.User.loginWithMIC(window.location.href);
promise.then(function onSuccess(user) {
loginSuccess();
console.log(user);
}).catch(function onError(error) {
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.