Skip to content

Commit

Permalink
user: Fix how passwords were being stored and fetched
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonycastelli committed Jun 2, 2017
1 parent 91b7763 commit d67e9d0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Sources/App/Models/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit d67e9d0

Please sign in to comment.