From b599ff4e9a809900558138845ab9d411888a8e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Sun, 13 Jul 2014 16:27:05 +0200 Subject: [PATCH] Fix login and register function in Auth service --- app/coffee/modules/auth.coffee | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/coffee/modules/auth.coffee b/app/coffee/modules/auth.coffee index b01534ef..ebfd392c 100644 --- a/app/coffee/modules/auth.coffee +++ b/app/coffee/modules/auth.coffee @@ -69,11 +69,11 @@ class AuthService extends taiga.Service ## Http interface ################### - login: (data) -> + login: (data, type) -> url = @urls.resolve("auth") data = _.clone(data, false) - data.type = "normal" + data.type = if type then type else "normal" return @http.post(url, data).then (data, status) => user = @model.make_model("users", data.data) @@ -81,11 +81,12 @@ class AuthService extends taiga.Service @.setUser(user) return user - register: (data) -> + register: (data, type) -> url = @urls.resolve("auth-register") data = _.clone(data, false) - data.type = "public" + data.type = if type then type else "public" + data.existing = false return @http.post(url, data).then (response) => user = @model.make_model("users", response.data)