diff --git a/.dockerignore b/.dockerignore index ad63f70273b447516de6a05e6cb41ce3b8283663..37dc706bd50d364ab2507724e4b84e56565d2c85 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,5 +3,8 @@ log/ tmp/ public/system/ public/assets/ +public/uploads/ +public/attachments/ +public/packages/ vendor/ shared/ diff --git a/.gitignore b/.gitignore index 0c0352a5b475ef0a6c3d4778850d35d882584f2f..965bd6d8d1cc84d34486a3aa59c0b1e59bbc1e24 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,9 @@ /db/development.sqlite3 /db/test.sqlite3 /public/assets +/public/uploads +/public/attachments +/public/packages /config/orientdb.yml /config/dspace.yml /shared/* diff --git a/app/controllers/concerns/downloadable_controller.rb b/app/controllers/concerns/downloadable_controller.rb index e7e872cfeac592c2fa8e506dab3674c567d1b14c..fd409412d6f69799a8a01bc9a0af428fa4d2651f 100644 --- a/app/controllers/concerns/downloadable_controller.rb +++ b/app/controllers/concerns/downloadable_controller.rb @@ -22,25 +22,14 @@ module DownloadableController # GET /learning_objects/1/download def download - object_id = params.values[2] - - object = LearningObject.where(id: object_id).first - attachment_id = object.attachment_id - - attachment = LearningObject::Attachment.where(id: attachment_id).first.as_json - - attachment_name = attachment["name"] - - link = attachment["retrieve_link"] - source = "https://mecdb4.c3sl.ufpr.br:8443" + link - - require 'open-uri' - - data = URI.open(source) - send_data data, :disposition => 'attachment', :filename=>attachment_name - - # https://mecdb4.c3sl.ufpr.br:8443/rest/bitstreams/11104/retrieve - # https://api.portalmec.c3sl.ufpr.br/v1/learning_objects/10943/download + # Change request.remote_ip to req.env["HTTP_X_REAL_IP"] in production + downloadable.download(current_user, request.remote_ip) + link = downloadable.download_link + if !link.blank? + redirect_to link + else + render status: :internal_server_error + end end protected diff --git a/app/controllers/v1/users_controller.rb b/app/controllers/v1/users_controller.rb index 55c574c05f1a046eb2ca0d63608293bf6ffa322b..48bdc5a1121e8aaa52ec197e63c7bc3c2d8977a0 100644 --- a/app/controllers/v1/users_controller.rb +++ b/app/controllers/v1/users_controller.rb @@ -49,7 +49,7 @@ class V1::UsersController < ApplicationController end def confirm_email - link = "https://plataformaintegrada.mec.gov.br/confirmacao-de-email" + link = "https://mecred.mec.gov.br/entrar" @user = User.find_by_confirm_token(params[:id]) if @user diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index c4ff9dc1d67f0e87a5f704f6198cbe12739d4249..5917881f7445f20d957352e69fce25b3e13b77c6 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -1,25 +1,25 @@ class UserMailer < ActionMailer::Base #set the default email sender - default from: 'integrada.contato@mec.gov.br' + default from: 'mecred@inf.ufpr.br' #function to send email to user when he/she is created through the admin panel def welcome_email (user) @user = user - mail(to: @user.email, subject: 'Bem vindo ao PortalMec!') + mail(to: @user.email, subject: 'Bem vindo ao MECRED!') end #function to send email confirmation to user, this view is located in app/views/user_mailer/email_confirmation.html.erb def email_confirmation (user) @user = user - mail(from: format_sender('plataformamecred@c3sl.ufpr.br', 'Plataforma MEC RED'), + mail(from: format_sender('mecred@inf.ufpr.br', 'MEC RED'), to: @user.email, subject: 'Confirme sua conta na Plataforma MEC RED') end def users_email_sender (email, subject, body) @body = body - mail(from: "integrada.contato@mec.gov.br", to: email, subject: subject) + mail(from: "mecred@inf.ufpr.br", to: email, subject: subject) end def format_sender(email, name) diff --git a/app/views/user_mailer/email_confirmation.html.erb b/app/views/user_mailer/email_confirmation.html.erb index 8f33e388bb58cd92795694bedcc2f404c44c2420..dbd830ae5957c4fec5330fba8111c1c009283c87 100644 --- a/app/views/user_mailer/email_confirmation.html.erb +++ b/app/views/user_mailer/email_confirmation.html.erb @@ -6,12 +6,12 @@ <body> <p>Olá, <%= @user.name %>!</br></p> - <p>Boas-vindas à Plataforma MEC de Recursos Educacionais Digitais!</p> + <p>Boas-vindas à Plataforma MEC RED!</p> <p>Para confirmar sua conta, clique <%= link_to 'aqui', confirm_email_v1_user_url(@user.confirm_token)%></p> <p>Esta mensagem é gerada automaticamente, portanto não pode ser respondida.</p> - <p>Caso queira se comunicar conosco, acesse nossa aba de <%= link_to 'Contato', 'https://plataformaintegrada.mec.gov.br/contato/Feedback' %>.</br></p> + <p>Caso queira se comunicar conosco, acesse nossa aba de <%= link_to 'Contato', 'https://mecred.mec.gov.br/contato' %>.</br></p> <p>Agradecemos seu cadastro,</p> <p>Equipe Plataforma MEC RED</p> </body> -</html> \ No newline at end of file +</html> diff --git a/app/views/user_mailer/email_confirmation.text.erb b/app/views/user_mailer/email_confirmation.text.erb index a9626157ada07dccffeeed28e758021ba14cac35..bf019264decf7e1acc537ae4d225a1f3a3c1f841 100644 --- a/app/views/user_mailer/email_confirmation.text.erb +++ b/app/views/user_mailer/email_confirmation.text.erb @@ -1,9 +1,9 @@ Olá, <%= @user.name %>! -Boas-vindas à Plataforma MEC de Recursos Educacionais Digitais! +Boas-vindas à Plataforma MEC RED! Para confirmar sua conta, clique <%= link_to 'aqui', confirm_email_v1_user_url(@user.confirm_token)%>. Esta mensagem é gerada automaticamente, portanto não pode ser respondida. -Caso queira se comunicar conosco, acesse nossa aba de <%= link_to 'Contato', 'https://plataformaintegrada.mec.gov.br/contato/Feedback' %>. +Caso queira se comunicar conosco, acesse nossa aba de <%= link_to 'Contato', 'https://mecred.mec.gov.br/contato' %>. Agradecemos seu cadastro, Equipe Plataforma MEC RED diff --git a/docker-compose.yml b/docker-compose.yml index 23ace3b3ac30641dcf691a40f335c532db817b42..8cfa9abac767f4b87d7e246aa79ffe57190721a7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,7 +27,7 @@ services: depends_on: - redis ports: - - "3000:3000" + - "3001:3001" volumes: - .:/app - gem_cache:/usr/local/bundle/gems