Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
57374fea
Commit
57374fea
authored
Jan 24, 2017
by
Markus Koller
Committed by
Alexis Reigel
Apr 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move AuthHelper#two_factor_skippable? into ApplicationController
parent
aaa49c2c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
12 deletions
+7
-12
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+7
-0
app/helpers/auth_helper.rb
app/helpers/auth_helper.rb
+0
-12
No files found.
app/controllers/application_controller.rb
View file @
57374fea
...
...
@@ -25,6 +25,7 @@ class ApplicationController < ActionController::Base
helper_method
:can?
,
:current_application_settings
helper_method
:import_sources_enabled?
,
:github_import_enabled?
,
:gitea_import_enabled?
,
:github_import_configured?
,
:gitlab_import_enabled?
,
:gitlab_import_configured?
,
:bitbucket_import_enabled?
,
:bitbucket_import_configured?
,
:google_code_import_enabled?
,
:fogbugz_import_enabled?
,
:git_import_enabled?
,
:gitlab_project_import_enabled?
helper_method
:two_factor_grace_period_expired?
,
:two_factor_skippable?
rescue_from
Encoding
::
CompatibilityError
do
|
exception
|
log_exception
(
exception
)
...
...
@@ -278,6 +279,12 @@ class ApplicationController < ActionController::Base
date
&&
(
date
+
two_factor_grace_period
.
hours
)
<
Time
.
current
end
def
two_factor_skippable?
two_factor_authentication_required?
&&
!
current_user
.
two_factor_enabled?
&&
!
two_factor_grace_period_expired?
end
def
skip_two_factor?
session
[
:skip_tfa
]
&&
session
[
:skip_tfa
]
>
Time
.
current
end
...
...
app/helpers/auth_helper.rb
View file @
57374fea
...
...
@@ -64,18 +64,6 @@ module AuthHelper
current_user
.
identities
.
exists?
(
provider:
provider
.
to_s
)
end
def
two_factor_skippable?
current_application_settings
.
require_two_factor_authentication
&&
!
current_user
.
two_factor_enabled?
&&
current_application_settings
.
two_factor_grace_period
&&
!
two_factor_grace_period_expired?
end
def
two_factor_grace_period_expired?
current_user
.
otp_grace_period_started_at
&&
(
current_user
.
otp_grace_period_started_at
+
current_application_settings
.
two_factor_grace_period
.
hours
)
<
Time
.
current
end
def
unlink_allowed?
(
provider
)
%w(saml cas3)
.
exclude?
(
provider
.
to_s
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment