From d67e9d094f696479220104f400153fdec4a3b6a6 Mon Sep 17 00:00:00 2001 From: Anthony Castelli Date: Fri, 2 Jun 2017 13:37:28 -0700 Subject: [PATCH] user: Fix how passwords were being stored and fetched --- Sources/App/Models/User.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Sources/App/Models/User.swift b/Sources/App/Models/User.swift index abfb897..86d024b 100644 --- a/Sources/App/Models/User.swift +++ b/Sources/App/Models/User.swift @@ -59,13 +59,15 @@ final class User: Model { init(row: Row) throws { username = try row.get("username") - password = try row.get("password") + + let passwordAsString: String = try row.get("password") + password = passwordAsString.makeBytes() } func makeRow() throws -> Row { var row = Row() try row.set("username", username) - try row.set("password", password) + try row.set("password", password.makeString()) return row } } @@ -189,7 +191,7 @@ extension User: JSONConvertible { var json = JSON() try json.set("id", id) try json.set("username", username) - try json.set("password", password) + try json.set("password", password.makeString()) return json } }