diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e30bff9..4a3c2ea6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - ... ### Misc +- Plugin based authentication. - Added Taiga Style Guide in support Pages to enhance open source design. - Lots of small and not so small bugfixes. diff --git a/app/coffee/modules/auth.coffee b/app/coffee/modules/auth.coffee index 5e260cea..856488ef 100644 --- a/app/coffee/modules/auth.coffee +++ b/app/coffee/modules/auth.coffee @@ -197,7 +197,9 @@ LoginDirective = ($auth, $confirm, $location, $config, $routeParams, $navUrls, $ "password": $el.find("form.login-form input[name=password]").val() } - promise = $auth.login(data) + loginFormType = $config.get("loginFormType", "normal") + + promise = $auth.login(data, loginFormType) return promise.then(onSuccess, onError) $el.on "submit", "form", submit diff --git a/app/coffee/modules/integrations/github.coffee b/app/coffee/modules/integrations/github.coffee deleted file mode 100644 index fa61a86f..00000000 --- a/app/coffee/modules/integrations/github.coffee +++ /dev/null @@ -1,111 +0,0 @@ -### -# Copyright (C) 2014 Andrey Antukh -# Copyright (C) 2014 Jesús Espino Garcia -# Copyright (C) 2014 David Barragán Merino -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -# File: modules/integrations/github.coffee -### - -taiga = @.taiga - -module = angular.module("taigaIntegrations") - -AUTH_URL = "https://github.com/login/oauth/authorize" - - -############################################################################# -## User story team requirements button directive -############################################################################# - -GithubLoginButtonDirective = ($window, $params, $location, $config, $events, $confirm, $auth, $navUrls, $loader) -> - # Login or registar a user with his/her github account. - # - # Example: - # tg-github-login-button() - # - # Requirements: - # - ... - - template = """ - - - Login with Github - - """ #TODO: i18n - - link = ($scope, $el, $attrs) -> - clientId = $config.get("gitHubClientId", null) - return if not clientId - - renderGitHubButton = -> - $el.html(template) if clientId - - loginOnSuccess = (response) -> - if $params.next and $params.next != $navUrls.resolve("login") - nextUrl = $params.next - else - nextUrl = $navUrls.resolve("home") - - $events.setupConnection() - - $location.search("next", null) - $location.search("token", null) - $location.search("state", null) - $location.search("code", null) - $location.path(nextUrl) - - loginOnError = (response) -> - $location.search("state", null) - $location.search("code", null) - $loader.pageLoaded() - - if response.data.error_message - $confirm.notify("light-error", response.data.error_message ) - else - $confirm.notify("light-error", "Our Oompa Loompas have not been able to get you - credentials from GitHub.") #TODO: i18n - - loginWithGitHubAccount = -> - type = $params.state - code = $params.code - token = $params.token - - return if not (type == "github" and code) - $loader.start() - - data = {code: code, token: token} - $auth.login(data, type).then(loginOnSuccess, loginOnError) - - renderGitHubButton() - loginWithGitHubAccount() - - $el.on "click", ".button-github", (event) -> - redirectToUri = $location.absUrl() - url = "#{AUTH_URL}?client_id=#{clientId}&redirect_uri=#{redirectToUri}&state=github&scope=user:email" - $window.location.href = url - - $scope.$on "$destroy", -> - $el.off() - - return { - link: link - restrict: "EA" - template: "" - } - -module.directive("tgGithubLoginButton", ["$window", '$routeParams', "$tgLocation", "$tgConfig", "$tgEvents", - "$tgConfirm", "$tgAuth", "$tgNavUrls", "tgLoader", - GithubLoginButtonDirective]) diff --git a/app/partials/includes/modules/login-form.jade b/app/partials/includes/modules/login-form.jade index 67d510bf..3517cbde 100644 --- a/app/partials/includes/modules/login-form.jade +++ b/app/partials/includes/modules/login-form.jade @@ -12,6 +12,6 @@ div.login-form-container(tg-login) fieldset button.button-green.submit-button(type="submit", title="Sign in") Sign in - fieldset(tg-github-login-button) + fieldset(ng-repeat="plugin in contribPlugins|filter:{type: 'auth'}", ng-include="plugin.template") tg-public-register-message diff --git a/app/styles/components/buttons.scss b/app/styles/components/buttons.scss index e340990c..6a270a08 100755 --- a/app/styles/components/buttons.scss +++ b/app/styles/components/buttons.scss @@ -100,11 +100,11 @@ a.button-bulk { transition: background .3s linear; } } -.button-github { +.button-auth { @extend %button; background: $grayer; vertical-align: middle; - .icon { + .icon, img { @extend %large; color: $white; margin-right: .5rem;