From bf80d4bf73132976ee2667596ff6d1906c398f93 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sun, 7 Dec 2014 18:07:05 +0000 Subject: [PATCH] Enabled bcrypt on Linux. Closes #25. --- forum.nim | 9 ++++++++- nimforum.babel | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/forum.nim b/forum.nim index 3287c76..76613dd 100644 --- a/forum.nim +++ b/forum.nim @@ -9,6 +9,10 @@ import os, strutils, times, md5, strtabs, cgi, math, db_sqlite, matchers, rst, rstgen, captchas, scgi, jester, asyncdispatch, asyncnet, cache, sequtils + +when not defined(windows): + import bcrypt # TODO + from htmlgen import tr, th, td, span const @@ -221,7 +225,10 @@ proc makeSalt(): string = proc makePassword(password, salt: string): string = ## Creates an MD5 hash by combining password and salt. - result = getMD5(salt & getMD5(password)) + when defined(windows): + result = getMD5(salt & getMD5(password)) + else: + result = hash(getMD5(salt & getMD5(password))) # ----------------------------------------------------------------------------- template `||`(x: expr): expr = (if not isNil(x): x else: "") diff --git a/nimforum.babel b/nimforum.babel index 6c6f161..bcd7c68 100644 --- a/nimforum.babel +++ b/nimforum.babel @@ -8,4 +8,4 @@ license = "MIT" bin = "forum" [Deps] -Requires: "nimrod >= 0.9.2, cairo#head, jester#head" +Requires: "nimrod >= 0.9.2, cairo#head, jester#head, bcrypt#head"