Compare commits
86 Commits
7fa58df5b0
...
ef9cb2468d
Author | SHA1 | Date |
---|---|---|
Tuan | ef9cb2468d | 3 years ago |
Claire | ddf3f4cf85 | 3 years ago |
Claire | a85eb7d930 | 3 years ago |
Claire | 0c6dfcf3de | 3 years ago |
Claire | cdf20f4367 | 3 years ago |
Shlee | a2ce7508c9 | 3 years ago |
Eugen Rochko | 7095c80373 | 3 years ago |
dependabot[bot] | ca8ac1a639 | 3 years ago |
dependabot[bot] | 5c112959aa | 3 years ago |
Eugen Rochko | 275fa4746b | 3 years ago |
Daigo 3 Dango | 3d5183e99c | 3 years ago |
Claire | f040b9aee3 | 3 years ago |
Claire | 101f8616fe | 3 years ago |
Claire | 3160e050a9 | 3 years ago |
dependabot[bot] | c4568e3b60 | 3 years ago |
dependabot[bot] | ca662c13f0 | 3 years ago |
dependabot[bot] | 6eaa39c387 | 3 years ago |
dependabot[bot] | e5b4b672f0 | 3 years ago |
dependabot[bot] | d36cfb99da | 3 years ago |
dependabot[bot] | 895f1a531d | 3 years ago |
Eugen Rochko | 771c9d4ba8 | 3 years ago |
Claire | 2e0eac71dd | 3 years ago |
Claire | 8569126c2e | 3 years ago |
Claire | e2844b7e58 | 3 years ago |
Claire | 225c6582d1 | 3 years ago |
Akihiko Odaki | 8af7f3b063 | 3 years ago |
Ikko Ashimine | 67226acf7e | 3 years ago |
Claire | 1381e0e1d9 | 3 years ago |
dependabot[bot] | 9f76be5e7d | 3 years ago |
dependabot[bot] | 23c180b02b | 3 years ago |
dependabot[bot] | 7b14b8074d | 3 years ago |
Claire | 49219508bc | 3 years ago |
Claire | 0c2eb949fc | 3 years ago |
Claire | 1e2097afd4 | 3 years ago |
Eugen Rochko | 38b3419950 | 3 years ago |
dependabot[bot] | 92c8c30e17 | 3 years ago |
dependabot[bot] | 01de07c91a | 3 years ago |
dependabot[bot] | 3460df6fe3 | 3 years ago |
dependabot[bot] | 78acea283d | 3 years ago |
dependabot[bot] | 6f533710e0 | 3 years ago |
dependabot[bot] | 90413598a3 | 3 years ago |
dependabot[bot] | c5f8c78a07 | 3 years ago |
dependabot[bot] | b983fdca54 | 3 years ago |
Claire | f4b9d94ce7 | 3 years ago |
Claire | 81d8a20a88 | 3 years ago |
Claire | 653c925beb | 3 years ago |
Claire | a4c828f8e7 | 3 years ago |
David Sterry | ba8f4535e3 | 3 years ago |
Claire | d1780fb9a4 | 3 years ago |
David Sterry | 7c27ccb8d8 | 3 years ago |
Yamagishi Kazutoshi | 04a552f076 | 3 years ago |
Claire | ff3626269e | 3 years ago |
Claire | a993ff6e2f | 3 years ago |
Claire | 9e5a1daa9b | 3 years ago |
Claire | e592e47e19 | 3 years ago |
Claire | 07ff8cb019 | 3 years ago |
Claire | 0eebade48c | 3 years ago |
Claire | 83b4e8584b | 3 years ago |
dependabot[bot] | 9cd724a3b4 | 3 years ago |
dependabot[bot] | afc170a231 | 3 years ago |
dependabot[bot] | 05a62819c7 | 3 years ago |
Claire | 62bf929684 | 3 years ago |
Claire | b6f952ec5b | 3 years ago |
Claire | f024f523b2 | 3 years ago |
Claire | 036ec18fb3 | 3 years ago |
Claire | 2a4e44a725 | 3 years ago |
Claire | 86aca08ec6 | 3 years ago |
dependabot[bot] | a6f03e179a | 3 years ago |
dependabot[bot] | e724a3ea64 | 3 years ago |
dependabot[bot] | aab731e926 | 3 years ago |
dependabot[bot] | f2a1cf7af9 | 3 years ago |
dependabot[bot] | 31ec06bcf9 | 3 years ago |
dependabot[bot] | 50ce660277 | 3 years ago |
Claire | 1c21dcfa35 | 3 years ago |
Claire | 262c7bcb57 | 3 years ago |
Claire | 776e00f193 | 3 years ago |
Claire | 979059fbc9 | 3 years ago |
Eugen Rochko | d10d1e5eac | 3 years ago |
Claire | 37fd9670a5 | 3 years ago |
Claire | 63b807cffc | 3 years ago |
Eugen Rochko | d174d12c83 | 3 years ago |
dependabot[bot] | 946200b471 | 3 years ago |
dependabot[bot] | 8da9afd60f | 3 years ago |
dependabot[bot] | 71feb5b112 | 3 years ago |
dependabot[bot] | 2a2d6880f0 | 3 years ago |
dependabot[bot] | f8033c8ac0 | 3 years ago |
@ -0,0 +1,42 @@ |
||||
name: Bug Report |
||||
description: If something isn't working as expected |
||||
labels: bug |
||||
body: |
||||
- type: markdown |
||||
attributes: |
||||
value: | |
||||
Make sure that you are submitting a new bug that was not previously reported or already fixed. |
||||
|
||||
Please use a concise and distinct title for the issue. |
||||
- type: input |
||||
attributes: |
||||
label: Expected behaviour |
||||
description: What should have happened? |
||||
validations: |
||||
required: true |
||||
- type: input |
||||
attributes: |
||||
label: Actual behaviour |
||||
description: What happened? |
||||
validations: |
||||
required: true |
||||
- type: textarea |
||||
attributes: |
||||
label: Steps to reproduce the problem |
||||
description: What were you trying to do? |
||||
value: | |
||||
1. |
||||
2. |
||||
3. |
||||
... |
||||
validations: |
||||
required: true |
||||
- type: textarea |
||||
attributes: |
||||
label: Specifications |
||||
description: | |
||||
What version or commit hash of Mastodon did you find this bug in? |
||||
|
||||
If a front-end issue, what browser and operating systems were you using? |
||||
validations: |
||||
required: true |
@ -0,0 +1,21 @@ |
||||
name: Feature Request |
||||
description: I have a suggestion |
||||
body: |
||||
- type: markdown |
||||
attributes: |
||||
value: | |
||||
Please use a concise and distinct title for the issue. |
||||
|
||||
Consider: Could it be implemented as a 3rd party app using the REST API instead? |
||||
- type: textarea |
||||
attributes: |
||||
label: Pitch |
||||
description: Describe your idea for a feature. Make sure it has not already been suggested/implemented/turned down before. |
||||
validations: |
||||
required: true |
||||
- type: textarea |
||||
attributes: |
||||
label: Motivation |
||||
description: Why do you think this feature is needed? Who would benefit from it? |
||||
validations: |
||||
required: true |
@ -1,7 +1,7 @@ |
||||
--- |
||||
name: Support |
||||
about: Ask for help with your deployment |
||||
|
||||
title: DO NOT CREATE THIS ISSUE |
||||
--- |
||||
|
||||
We primarily use GitHub as a bug and feature tracker. For usage questions, troubleshooting of deployments and other individual technical assistance, please use one of the resources below: |
@ -1,12 +0,0 @@ |
||||
--- |
||||
name: Bug Report |
||||
about: If something isn't working as expected |
||||
labels: bug |
||||
--- |
||||
|
||||
[Issue text goes here]. |
||||
|
||||
* * * * |
||||
|
||||
- [ ] I searched or browsed the repo’s other issues to ensure this is not a duplicate. |
||||
- [ ] This bugs also occur on vanilla Mastodon |
@ -1,16 +0,0 @@ |
||||
--- |
||||
name: Feature Request |
||||
about: I have a suggestion |
||||
--- |
||||
|
||||
<!-- Please use a concise and distinct title for the issue --> |
||||
|
||||
<!-- Consider: Could it be implemented as a 3rd party app using the REST API instead? --> |
||||
|
||||
### Pitch |
||||
|
||||
<!-- Describe your idea for a feature. Make sure it has not already been suggested/implemented/turned down before --> |
||||
|
||||
### Motivation |
||||
|
||||
<!-- Why do you think this feature is needed? Who would benefit from it? --> |
@ -1 +1 @@ |
||||
2.7.2 |
||||
2.7.4 |
||||
|
@ -0,0 +1,27 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
module Admin |
||||
class SignInTokenAuthenticationsController < BaseController |
||||
before_action :set_target_user |
||||
|
||||
def create |
||||
authorize @user, :enable_sign_in_token_auth? |
||||
@user.update(skip_sign_in_token: false) |
||||
log_action :enable_sign_in_token_auth, @user |
||||
redirect_to admin_account_path(@user.account_id) |
||||
end |
||||
|
||||
def destroy |
||||
authorize @user, :disable_sign_in_token_auth? |
||||
@user.update(skip_sign_in_token: true) |
||||
log_action :disable_sign_in_token_auth, @user |
||||
redirect_to admin_account_path(@user.account_id) |
||||
end |
||||
|
||||
private |
||||
|
||||
def set_target_user |
||||
@user = User.find(params[:user_id]) |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,13 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
class Settings::LoginActivitiesController < Settings::BaseController |
||||
def index |
||||
@login_activities = LoginActivity.where(user: current_user).order(id: :desc).page(params[:page]) |
||||
end |
||||
|
||||
private |
||||
|
||||
def set_pack |
||||
use_pack 'settings' |
||||
end |
||||
end |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,35 @@ |
||||
# frozen_string_literal: true |
||||
# == Schema Information |
||||
# |
||||
# Table name: login_activities |
||||
# |
||||
# id :bigint(8) not null, primary key |
||||
# user_id :bigint(8) not null |
||||
# authentication_method :string |
||||
# provider :string |
||||
# success :boolean |
||||
# failure_reason :string |
||||
# ip :inet |
||||
# user_agent :string |
||||
# created_at :datetime |
||||
# |
||||
|
||||
class LoginActivity < ApplicationRecord |
||||
enum authentication_method: { password: 'password', otp: 'otp', webauthn: 'webauthn', sign_in_token: 'sign_in_token', omniauth: 'omniauth' } |
||||
|
||||
belongs_to :user |
||||
|
||||
validates :authentication_method, inclusion: { in: authentication_methods.keys } |
||||
|
||||
def detection |
||||
@detection ||= Browser.new(user_agent) |
||||
end |
||||
|
||||
def browser |
||||
detection.id |
||||
end |
||||
|
||||
def platform |
||||
detection.platform.id |
||||
end |
||||
end |
@ -0,0 +1,17 @@ |
||||
- method_str = content_tag(:span, login_activity.omniauth? ? t(login_activity.provider, scope: 'auth.providers') : t(login_activity.authentication_method, scope: 'login_activities.authentication_methods'), class: 'target') |
||||
- ip_str = content_tag(:span, login_activity.ip, class: 'target') |
||||
- browser_str = content_tag(:span, t('sessions.description', browser: t("sessions.browsers.#{login_activity.browser}", default: "#{login_activity.browser}"), platform: t("sessions.platforms.#{login_activity.platform}", default: "#{login_activity.platform}")), class: 'target', title: login_activity.user_agent) |
||||
|
||||
.log-entry |
||||
.log-entry__header |
||||
.log-entry__avatar |
||||
.indicator-icon{ class: login_activity.success? ? 'success' : 'failure' } |
||||
= fa_icon login_activity.success? ? 'check' : 'times' |
||||
.log-entry__content |
||||
.log-entry__title |
||||
- if login_activity.success? |
||||
= t('login_activities.successful_sign_in_html', method: method_str, ip: ip_str, browser: browser_str) |
||||
- else |
||||
= t('login_activities.failed_sign_in_html', method: method_str, ip: ip_str, browser: browser_str) |
||||
.log-entry__timestamp |
||||
%time.formatted{ datetime: login_activity.created_at.iso8601 }= l(login_activity.created_at) |
@ -0,0 +1,15 @@ |
||||
- content_for :page_title do |
||||
= t 'login_activities.title' |
||||
|
||||
%p= t('login_activities.description_html') |
||||
|
||||
%hr.spacer/ |
||||
|
||||
- if @login_activities.empty? |
||||
%div.muted-hint.center-text |
||||
= t 'login_activities.empty' |
||||
- else |
||||
.announcements-list |
||||
= render partial: 'login_activity', collection: @login_activities |
||||
|
||||
= paginate @login_activities |
@ -0,0 +1,14 @@ |
||||
class CreateLoginActivities < ActiveRecord::Migration[6.1] |
||||
def change |
||||
create_table :login_activities do |t| |
||||
t.belongs_to :user, null: false, foreign_key: { on_delete: :cascade } |
||||
t.string :authentication_method |
||||
t.string :provider |
||||
t.boolean :success |
||||
t.string :failure_reason |
||||
t.inet :ip |
||||
t.string :user_agent |
||||
t.datetime :created_at |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,5 @@ |
||||
class AddSkipSignInTokenToUsers < ActiveRecord::Migration[6.1] |
||||
def change |
||||
add_column :users, :skip_sign_in_token, :boolean |
||||
end |
||||
end |
@ -0,0 +1,13 @@ |
||||
class FixCanonicalEmailBlocksForeignKey < ActiveRecord::Migration[6.1] |
||||
def up |
||||
safety_assured do |
||||
execute 'ALTER TABLE canonical_email_blocks DROP CONSTRAINT fk_rails_1ecb262096, ADD CONSTRAINT fk_rails_1ecb262096 FOREIGN KEY (reference_account_id) REFERENCES accounts(id) ON DELETE CASCADE;' |
||||
end |
||||
end |
||||
|
||||
def down |
||||
safety_assured do |
||||
execute 'ALTER TABLE canonical_email_blocks DROP CONSTRAINT fk_rails_1ecb262096, ADD CONSTRAINT fk_rails_1ecb262096 FOREIGN KEY (reference_account_id) REFERENCES accounts(id);' |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,8 @@ |
||||
Fabricator(:login_activity) do |
||||
user |
||||
strategy 'password' |
||||
success true |
||||
failure_reason nil |
||||
ip { Faker::Internet.ip_v4_address } |
||||
user_agent { Faker::Internet.user_agent } |
||||
end |
@ -0,0 +1,5 @@ |
||||
require 'rails_helper' |
||||
|
||||
RSpec.describe LoginActivity, type: :model do |
||||
|
||||
end |
@ -1,4 +1,37 @@ |
||||
require 'rails_helper' |
||||
|
||||
RSpec.describe BootstrapTimelineService, type: :service do |
||||
subject { BootstrapTimelineService.new } |
||||
|
||||
context 'when the new user has registered from an invite' do |
||||
let(:service) { double } |
||||
let(:autofollow) { false } |
||||
let(:inviter) { Fabricate(:user, confirmed_at: 2.days.ago) } |
||||
let(:invite) { Fabricate(:invite, user: inviter, max_uses: nil, expires_at: 1.hour.from_now, autofollow: autofollow) } |
||||
let(:new_user) { Fabricate(:user, invite_code: invite.code) } |
||||
|
||||
before do |
||||
allow(FollowService).to receive(:new).and_return(service) |
||||
allow(service).to receive(:call) |
||||
end |
||||
|
||||
context 'when the invite has auto-follow enabled' do |
||||
let(:autofollow) { true } |
||||
|
||||
it 'calls FollowService to follow the inviter' do |
||||
subject.call(new_user.account) |
||||
expect(service).to have_received(:call).with(new_user.account, inviter.account) |
||||
end |
||||
end |
||||
|
||||
context 'when the invite does not have auto-follow enable' do |
||||
let(:autofollow) { false } |
||||
|
||||
it 'calls FollowService to follow the inviter' do |
||||
subject.call(new_user.account) |
||||
expect(service).to_not have_received(:call) |
||||
end |
||||
end |
||||
|
||||
end |
||||
end |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue