pyc-website
main website for pyc inc.
git clone https://9o.is/git/pyc-website.git
commit 8909ad730360cb1e0925c0cd9a0c03e1d7d0871f parent c28682b97b0dd5cbcae9a2ba9bf4cc86beaf17d1 Author: Jul <jul@9o.is> Date: Mon, 21 Jul 2014 23:06:10 -0400 Atm model now has secret so it can authenticate and communicate with web server Diffstat:
| M | src/main/scala/inc/pyc/model/Atm.scala | | | 13 | +++++++++++-- |
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/main/scala/inc/pyc/model/Atm.scala b/src/main/scala/inc/pyc/model/Atm.scala @@ -10,10 +10,10 @@ import json._ import JsonDSL._ import mongodb.record._ import mongodb.record.field._ -import record.field._ +import record.field.{StringField, PostalCodeField, CountryField, Countries, TimeZoneField} import com.foursquare.rogue._ import org.joda.time._, format._ - +import net.liftmodules.mongoauth.field._ class Atm private () extends MongoRecord[Atm] with ObjectIdPk[Atm] { def meta = Atm @@ -36,6 +36,11 @@ class Atm private () extends MongoRecord[Atm] with ObjectIdPk[Atm] { object timezone extends TimeZoneField(this) + /** + * This is used for the ATM to authenticate and communicate with the web server. + */ + object secret extends PasswordField(this, 32, 32) + /** The Geolocation of the atm. */ object loc extends MongoCaseClassField[Atm, LatLong](this) { import Geocode._ @@ -54,6 +59,9 @@ class Atm private () extends MongoRecord[Atm] with ObjectIdPk[Atm] { (json transform { case JField("lat", lat) => JField("latitude", lat) case JField("long", lng) => JField("longitude", lng) + case JField("secret", _) => JField("secret", "") + case JField("ownerObj", _) => JField("ownerObj", "") + case JField("_id", _) => JField("_id", "") }) .asInstanceOf[JObject] } @@ -162,6 +170,7 @@ object FeaturedAtm { Atm.createRecord .name(name) + .secret("$2a$10$7ph0y0JVeN/NSmK0mpHYce.t4ZRatiCPV6jKtn9zl4RQMnPq50dSi") .loc(LatLong(42.654131, -73.75055600000002)) .address("5 Clinton Square") .city("Albany")