Skip to content

Commit

Permalink
Merge branch 'release/0.7.12.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperTux88 committed Jun 25, 2019
2 parents dc7c5ff + 1e8a96d commit 09a425c
Show file tree
Hide file tree
Showing 92 changed files with 821 additions and 309 deletions.
13 changes: 13 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# 0.7.12.0

## Refactor
* Harmonize markdown titles sizes [#8029](https://github.com/diaspora/diaspora/pull/8029)

## Bug fixes
* Improve handling of mixed case hostnames while fetching OpenGraph data [#8021](https://github.com/diaspora/diaspora/pull/8021)
* Fix "remember me" with two factor authentication enabled [#8031](https://github.com/diaspora/diaspora/pull/8031)

## Features
* Add line mentioning diaspora\* on the splash page [#7966](https://github.com/diaspora/diaspora/pull/7966)
* Improve communication about signing up on closed pods [#7896](https://github.com/diaspora/diaspora/pull/7896)

# 0.7.11.0

## Refactor
Expand Down
8 changes: 8 additions & 0 deletions app/assets/stylesheets/home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@
padding: 15px;
}

.part-of-diaspora {
font-style: italic;

a {
color: $white;
}
}

.login-form {
fieldset { background: none; }

Expand Down
24 changes: 24 additions & 0 deletions app/assets/stylesheets/markdown-content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,30 @@
}
}

h1 {
font-size: 2.7rem;
}

h2 {
font-size: 2.3rem;
}

h3 {
font-size: 2rem;
}

h4 {
font-size: 1.8rem;
}

h5 {
font-size: 1.6rem;
}

h6 {
font-size: 1.4rem;
}

.img-responsive {
display: inline;
}
Expand Down
23 changes: 12 additions & 11 deletions app/assets/stylesheets/registration.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.page-registrations.action-new,
.page-registrations.action-create {
.page-registrations {
.ball {
background: image-url('branding/ball.png') no-repeat;
background-size: contain;
Expand All @@ -12,19 +11,24 @@
height: 633px;
}

@media (max-width: $screen-xs-max) {
.v-center {
height: auto;
}
}

.content {
display: table-cell;
vertical-align: middle;

h2 {
h1 {
font-size: 35px;
margin: 12px;
text-align: center;
margin: 12px 0;
}
}

form {
max-width: 400px;
max-width: 500px;
}

.captcha-img {
Expand All @@ -34,16 +38,13 @@
width: 120px;
}

.captcha-input {
.form-control.captcha-input {
border-bottom: 1px solid $input-border;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
box-sizing: border-box;
font-size: 16px;
height: 40px;
line-height: $line-height-base;
padding: 10px 10px 10px 130px;
width: 100%;
padding-left: 130px;
}

.terms > a {
Expand Down
12 changes: 8 additions & 4 deletions app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# the COPYRIGHT file.

class RegistrationsController < Devise::RegistrationsController
before_action :check_registrations_open_or_valid_invite!
before_action :check_registrations_open_or_valid_invite!, except: :registrations_closed

layout -> { request.format == :mobile ? "application" : "with_header" }
layout -> { request.format == :mobile ? "application" : "with_header_with_footer" }

def create
@user = User.build(user_params)
Expand All @@ -28,13 +28,17 @@ def create
end
end

def registrations_closed
render "registrations/registrations_closed"
end

private

def check_registrations_open_or_valid_invite!
return true if AppConfig.settings.enable_registrations? || invite.try(:can_be_used?)

flash[:error] = params[:invite] ? t("registrations.invalid_invite") : t("registrations.closed")
redirect_to new_user_session_path
flash[:error] = t("registrations.invalid_invite") if params[:invite]
redirect_to registrations_closed_path
end

def invite
Expand Down
14 changes: 7 additions & 7 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ class SessionsController < Devise::SessionsController
# rubocop:enable Rails/LexicallyScopedActionFilter

def find_user
return User.find(session[:otp_user_id]) if session[:otp_user_id]
return User.find_for_authentication(username: params[:user][:username]) if params[:user][:username]

User.find_for_authentication(username: params[:user][:username]) if params[:user][:username]
User.find(session[:otp_user_id]) if session[:otp_user_id]
end

def authenticate_with_2fa
self.resource = find_user
u = find_user

return true unless u&.otp_required_for_login?
return true unless resource&.otp_required_for_login?

if params[:user][:otp_attempt].present? && session[:otp_user_id]
authenticate_with_two_factor_via_otp(u)
elsif u&.valid_password?(params[:user][:password])
prompt_for_two_factor(u)
authenticate_with_two_factor_via_otp(resource)
else
strategy = Warden::Strategies[:database_authenticatable].new(warden.env, :user)
prompt_for_two_factor(strategy.user) if strategy.valid? && strategy._run!.successful?
end
end

Expand Down
4 changes: 3 additions & 1 deletion app/models/open_graph_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def self.find_or_create_by(opts)
end

def fetch_and_save_opengraph_data!
object = OpenGraphReader.fetch!(self.url)
uri = URI.parse(url.start_with?("http") ? url : "http://#{url}")
uri.normalize!
object = OpenGraphReader.fetch!(uri)

return unless object

Expand Down
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,10 @@ def after_database_authentication
end
end

def remember_me
true
end

private

def clearable_fields
Expand Down
1 change: 0 additions & 1 deletion app/views/devise/passwords/edit.haml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
autocorrect: "off",
aria: {labelledby: "passwordConfirmationLabel"}

= hidden_field(:user, :remember_me, value: 1)
= f.submit t("devise.passwords.edit.change_password"), class: "btn btn-block btn-primary"

.text-center
Expand Down
4 changes: 4 additions & 0 deletions app/views/home/default.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
.row
.col-md-8.text-center
%h1= t("home.default.headline", pod_name: pod_name)
- if pod_name != "diaspora*"
%h2.part-of-diaspora
!= t("home.default.part_of_diaspora",
diaspora_site_link: link_to(t("home.default.diaspora_site_link"), "https://diasporafoundation.org/"))
%h2= t("home.default.byline")
.col-md-4.login-form
= render partial: "sessions/form", locals: {mobile: false, resource: User.new, resource_name: :user}
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/_header_not_connected.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%ul.nav.navbar-nav.navbar-right
- if AppConfig.settings.enable_registrations? && !current_page?(controller: "/registrations", action: :new)
- unless current_page?(controller: "/registrations", action: :new)
%li= link_to t("devise.shared.links.sign_up"), new_user_registration_path, class: "login"
- unless current_page?(controller: "/sessions", action: :new)
%li= link_to t("devise.shared.links.sign_in"), new_user_session_path, class: "login"
2 changes: 1 addition & 1 deletion app/views/registrations/_form.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- if mobile
%legend
= image_tag("branding/logos/header-logo2x.png", height: 40, width: 40)
= t("aspects.aspect_stream.make_something")
= AppConfig.settings.pod_name

- if mobile
= f.label :email, t("registrations.new.email"), class: "control-label", id: "emailLabel"
Expand Down
11 changes: 11 additions & 0 deletions app/views/registrations/_registrations_closed.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
%h2
= t("devise.shared.links.sign_up_closed")

!= t("registrations.closed.closed_pod",
wiki: link_to(t("registrations.closed.another_pod"), "https://diasporafoundation.org/getting_started/sign_up"))

!= t("registrations.closed.find_pods",
poduptime: link_to("Poduptime", "https://podupti.me/"))

!= t("registrations.closed.other_questions",
wiki: link_to("Wiki", "https://wiki.diasporafoundation.org/Choosing_a_pod"))
15 changes: 7 additions & 8 deletions app/views/registrations/new.haml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#registration
.container
.row
.col-md-10.offset1
.col-md-7.hidden-phone
%h1.ball
.col-md-5.v-center
.content.text-center
%h2#pod-name
= AppConfig.settings.pod_name
.col-sm-6.hidden-xs
.ball
.col-sm-6.col-xs-12.v-center
.content.text-center
%h1#pod-name
= AppConfig.settings.pod_name

= render partial: "form", locals: {mobile: false}
= render partial: "form", locals: {mobile: false}
8 changes: 8 additions & 0 deletions app/views/registrations/registrations_closed.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#registration
.container
.row
.col-sm-6.hidden-xs
.ball
.col-sm-6.col-xs-12.v-center
.content
= render partial: "registrations_closed"
10 changes: 10 additions & 0 deletions app/views/registrations/registrations_closed.mobile.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

.stream#main-stream
- flash.each do |name, msg|
.expose#flash-container
.flash-message{class: "message alert alert-#{flash_class name}", role: "alert"}
= msg

.login-form
.login-container
= render partial: "registrations_closed"
1 change: 0 additions & 1 deletion app/views/sessions/_form.haml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@
autocorrect: "off",
aria: {labelledby: "passwordLabel"}

= f.hidden_field :remember_me, value: 1
= f.submit t("devise.sessions.new.sign_in"), class: "btn btn-large btn-block btn-primary"
2 changes: 1 addition & 1 deletion config/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

defaults:
version:
number: "0.7.11.0" # Do not touch unless doing a release, do not backport the version number that's in master
number: "0.7.12.0" # Do not touch unless doing a release, do not backport the version number that's in master
heroku: false
environment:
url: "http://localhost:3000/"
Expand Down
5 changes: 0 additions & 5 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ def to_mobile
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
config.warden do |manager|
manager.default_strategies(scope: :user).unshift :two_factor_authenticatable
manager.default_strategies(scope: :user).unshift :two_factor_backupable
end

# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmation, reset password and unlock tokens in the database.
Expand Down
2 changes: 1 addition & 1 deletion config/locales/devise/devise.pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pt-BR:
remember_me: "Lembre-se de mim"
sign_in: "Entrar"
username: "Nome de usuário"
signed_in: "Você entrou com sucesso."
signed_in: "Você entrou."
signed_out: "Você saiu com sucesso."
shared:
links:
Expand Down
1 change: 0 additions & 1 deletion config/locales/diaspora/ar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ ar:
updated: "تم تحديث ملفك الشخصى"
public: "عامّ"
registrations:
closed: "التسجيلات مغلقة على هذه المنصة"
create:
success: "لقد انضممت الى دياسبرا "
new:
Expand Down

0 comments on commit 09a425c

Please sign in to comment.