serverData: role: admin samjones: password: 7KZrUQcnFUDNOQtqtKqhCA==ElDieSHdI2vtiws41JF/HQ== clientData: favoriteDessert: shortbread serverData: role: user an example of a user file
the user file. Can be json, js or yml path: ./users.yml # the name of a HMAC digest algorithm hash: 'md5' # the number of times the algorithm should be applied iterations: 100 # the length of the resulting key keyLength: 32
token = localStorage.getItem('deepstream-token') //if it is not null, if (token) { //token exists but not validated yet //attempt to resume the previous session using this token resumeSession(token) } else { //logging in for the first time loginWithEmail() } 1
prompt("Enter email", ""); var myPass = prompt("Enter your password", ""); client.login({ email: myEmail, password: myPass }, function(success, data) { if (success) { //replace the token in localStorage with new one localStorage.setItem('deepstream-token', data.token) onSuccessfulLogin(data) } else { // user login failed } }) } 3
sure that # the car that's sold exists and that its price # is the same or lower than what the customer is charged write: "_(data.carId) !== null && _(data.carId).price <= data.price" simple cross-referencing