Very basic devise functionality in javascript