mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-28 09:24:24 +01:00
Merge branch 'dev'
This commit is contained in:
commit
be37f3fc8a
@ -4,17 +4,15 @@
|
||||
|
||||
## list of supported authentication methods
|
||||
METHODS = {
|
||||
'DatabaseProvider' : 'Base de données locale',
|
||||
#'OAuthProvider' : 'OAuth 1.0',
|
||||
'OAuth2Provider' : 'OAuth 2.0',
|
||||
#'LdapProvider' : 'LDAP'
|
||||
'DatabaseProvider' : 'local_database',
|
||||
'OAuth2Provider' : 'o_auth2',
|
||||
}
|
||||
|
||||
##
|
||||
# Iterate through the provided array and return the index of the requested element
|
||||
# @param elements {Array} array of objects with property 'id'
|
||||
# @param id {Number} id of the element to retrieve in the list
|
||||
# @returns {Number} index of the requested element, in the provided array
|
||||
# @param elements {Array<{id:*}>}
|
||||
# @param id {*} id of the element to retrieve in the list
|
||||
# @returns {number} index of the requested element, in the provided array
|
||||
##
|
||||
findIdxById = (elements, id)->
|
||||
(elements.map (elem)->
|
||||
@ -58,7 +56,7 @@ Application.Controllers.controller "AuthentificationController", ["$scope", "$st
|
||||
$scope.getType = (type) ->
|
||||
text = METHODS[type]
|
||||
if typeof text != 'undefined'
|
||||
return text
|
||||
return _t(text)
|
||||
else
|
||||
return _t('unknown')+type
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
class="form-control"
|
||||
name="auth_provider[providable_type]"
|
||||
id="provider_type"
|
||||
ng-options="key as value for (key, value) in authMethods"
|
||||
ng-options="key as (value | translate) for (key, value) in authMethods"
|
||||
ng-disabled="mode == 'edition'"
|
||||
required>
|
||||
</select>
|
||||
|
@ -88,18 +88,27 @@
|
||||
<section class="widget panel b-a m m-t-lg" ng-show="ctrl.member">
|
||||
<div class="panel-heading b-b">
|
||||
<h3 ng-show="currentUser.role != 'admin'" translate>{{ 'my_group' }}</h3>
|
||||
<h3 ng-show="currentUser.role === 'admin'">{{ 'his_group' | translate:{GENDER:getGender(currentUser)}:"messageformat" }}</h3>
|
||||
<h3 ng-show="currentUser.role === 'admin'" translate translate-values="{GENDER:getGender(currentUser)}" translate-interpolation="messageformat">{{ 'his_group' }}</h3>
|
||||
</div>
|
||||
<div class="widget-content no-bg auto wrapper">
|
||||
<div ng-show="!changeGroup">
|
||||
<div class="well well-warning">
|
||||
<strong>{{getUserGroup().name}}</strong>
|
||||
</div>
|
||||
<button class="btn btn-default m-t" ng-click="changeGroup = !changeGroup" ng-show="(!selectedPlan && ctrl.member && !ctrl.member.subscribed_plan && ctrl.member.subscription) || (!paidPlan)">{{ 'he_wants_to_change_group' | translate:{ROLE:currentUser.role}:"messageformat" }}</button>
|
||||
<button class="btn btn-default m-t"
|
||||
ng-click="changeGroup = !changeGroup"
|
||||
ng-show="(!selectedPlan && ctrl.member && !ctrl.member.subscribed_plan && ctrl.member.subscription) || (!paidPlan)"
|
||||
translate
|
||||
translate-values="{ROLE:currentUser.role}"
|
||||
translate-interpolation="messageformat">{{ 'he_wants_to_change_group' }}</button>
|
||||
</div>
|
||||
<div ng-show="changeGroup">
|
||||
<select class="form-control" ng-options="g.id as g.name for g in groups" ng-model="userGroup"></select>
|
||||
<button class="btn btn-success m-t" ng-click="selectGroup()" translate translate-values="{ROLE:currentUser.role, GENDER:getGender(currentUser)}" translate-interpolation="messageformat">{{ 'change_my_group' }}</button>
|
||||
<button class="btn btn-success m-t"
|
||||
ng-click="selectGroup()"
|
||||
translate
|
||||
translate-values="{ROLE:currentUser.role, GENDER:getGender(currentUser)}"
|
||||
translate-interpolation="messageformat">{{ 'change_my_group' }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -79,7 +79,7 @@
|
||||
<section class="widget panel b-a m" ng-if="project.project_caos_attributes">
|
||||
<div class="panel-heading b-b">
|
||||
<span class="badge bg-warning pull-right">{{project.project_caos_attributes.length}}</span>
|
||||
<h3>{{ 'CAD_file_to_download' | translate:{ COUNT: project.project_caos_attributes.length }:"messageformat" }}</h3>
|
||||
<h3 translate translate-values="{COUNT:project.project_caos_attributes.length}" translate-interpolation="messageformat">{{ 'CAD_file_to_download' }}</h3>
|
||||
</div>
|
||||
|
||||
<ul class="widget-content list-group list-group-lg no-bg auto">
|
||||
|
@ -29,7 +29,7 @@ class Subscription < ActiveRecord::Base
|
||||
|
||||
reset_users_credits if expired_date_changed
|
||||
|
||||
# generate directement invoice
|
||||
# generate invoice
|
||||
stp_invoice = Stripe::Invoice.all(customer: user.stp_customer_id, limit: 1).data.first
|
||||
generate_invoice(stp_invoice.id).save if invoice
|
||||
# cancel subscription after create
|
||||
@ -209,8 +209,9 @@ class Subscription < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def expired_date_changed
|
||||
return true if expired_at_was.nil?
|
||||
expired_at_was.to_date != expired_at.to_date and expired_at > expired_at_was
|
||||
p_value = self.previous_changes[:expired_at][0]
|
||||
return true if p_value.nil?
|
||||
p_value.to_date != expired_at.to_date and expired_at > p_value
|
||||
end
|
||||
|
||||
def reset_users_credits
|
||||
|
@ -2,7 +2,7 @@ json.title notification.notification_type
|
||||
json.description _t('.user_NAME_has_merged_his_account_with_the_one_imported_from_PROVIDER_(UID)_html',
|
||||
{
|
||||
NAME: notification.attached_object.profile.full_name,
|
||||
GENDER: notification.attached_object.profile.gender,
|
||||
GENDER: bool_to_sym(notification.attached_object.profile.gender),
|
||||
PROVIDER: notification.attached_object.provider,
|
||||
UID: notification.attached_object.uid
|
||||
}) # messageFormat
|
||||
|
@ -14,12 +14,20 @@
|
||||
|
||||
<% active_provider = AuthProvider.active %>
|
||||
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
|
||||
<%
|
||||
url_path = user_omniauth_authorize_path(active_provider.strategy_name.to_sym)
|
||||
if url_path[0] == '/' and root_url[-1] == '/'
|
||||
url_path = root_url + url_path[1..-1]
|
||||
else
|
||||
url_path = root_url + url_path
|
||||
end
|
||||
%>
|
||||
|
||||
<p><%= t(".body.the_platform") %> <%= Setting.find_by(name: 'fablab_name').value %> <%= t(".body.is_changing_its_auth_system_and_will_now_use") %> <%= active_provider.name %> <%= t(".body.instead_of") %> <%= AuthProvider.find_by(status: 'previous').name %>.</p>
|
||||
|
||||
<p><%= t('.body.consequence_of_the_modification') %></p>
|
||||
|
||||
<p><%= t('.body.to_use_the_platform_thanks_for') %> <a href="<%= root_url+user_omniauth_authorize_path(active_provider.strategy_name.to_sym)%>?auth_token=<%= @attached_object.auth_token %>" target="_blank">
|
||||
<p><%= t('.body.to_use_the_platform_thanks_for') %> <a href="<%=url_path%>?auth_token=<%= @attached_object.auth_token %>" target="_blank">
|
||||
<%= t('.body.create_an_account_on') %> <%= active_provider.name %> <%= t('.body.or_use_an_existing_account_clicking_here') %></a></p>
|
||||
|
||||
<p><%= t('.body.in_case_of_problem_enter_the_following_code') %></p>
|
||||
|
@ -297,6 +297,8 @@ en:
|
||||
do_you_really_want_to_delete_the_TYPE_authentication_provider_NAME: "Do you really want to delete the {{TYPE}} authentication provider: {{NAME}}?" # angular interpolation
|
||||
authentication_provider_successfully_deleted: "Authentication provider successfully deleted."
|
||||
an_error_occurred_unable_to_delete_the_specified_provider: "An error occurred: unable to delete the specified provider."
|
||||
local_database: "Local database"
|
||||
o_auth2: "OAuth 2.0"
|
||||
|
||||
members_new:
|
||||
# add a member
|
||||
|
@ -297,6 +297,8 @@ fr:
|
||||
do_you_really_want_to_delete_the_TYPE_authentication_provider_NAME: "Êtes-vous sûr(e) de vouloir supprimer le fournisseur d'authentification {{TYPE}} : {{NAME}} ?" # angular interpolation
|
||||
authentication_provider_successfully_deleted: "Le fournisseur d'authentification a bien été supprimée."
|
||||
an_error_occurred_unable_to_delete_the_specified_provider: "Une erreur est survenue : impossible de supprimer le fournisseur spécifié."
|
||||
local_database: "Base de données locale"
|
||||
o_auth2: "OAuth 2.0"
|
||||
|
||||
members_new:
|
||||
# ajouter un membre
|
||||
|
@ -134,7 +134,7 @@ en:
|
||||
project_description: "Project description"
|
||||
by_name: "By {{NAME}}" # angular interpolation
|
||||
posted_on_: "Posted on"
|
||||
CAD_file_to_download: "{COUNT, plural, =0{No CAD file} =1{CAD file to download} other{CAD files to download}" # messageFormat interpolation
|
||||
CAD_file_to_download: "{COUNT, plural, =0{No CAD files} =1{CAD file to download} other{CAD files to download}}" # messageFormat interpolation
|
||||
licence: "Licence"
|
||||
report_an_abuse: "Report an abuse"
|
||||
unauthorized_operation: "Unauthorized operation"
|
||||
|
@ -37,11 +37,11 @@ en:
|
||||
<<: *errors
|
||||
|
||||
omniauth:
|
||||
# messages d'erreur lors de l'import d'un compte depuis un SSO
|
||||
# error messages when importing an account from a SSO
|
||||
email_already_linked_to_another_account_please_input_your_authentication_code: "E-mail address \"%{OLD_MAIL}\" is already linked to another account, please input your authentication code."
|
||||
your_username_is_already_linked_to_another_account_unable_to_update_it: "Your username (%{USERNAME}) is already linked to another account, unable to update it."
|
||||
your_email_address_is_already_linked_to_another_account_unable_to_update_it: "Your e-mail address (%{EMAIL}) is already linked to another account, unable to update it."
|
||||
this_account_is_already_linked_to_an_user_of_the_platform: "This account %{NAME} is already linked to an user of the platform."
|
||||
this_account_is_already_linked_to_an_user_of_the_platform: "This %{NAME} account is already linked to an user of the platform."
|
||||
|
||||
availabilities:
|
||||
# availability slots in the calendar
|
||||
|
Loading…
Reference in New Issue
Block a user