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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
d3ff8c1a
Commit
d3ff8c1a
authored
Jun 20, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make default value for otp_required_for_login false instead of null
parent
8304bed1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
8 deletions
+17
-8
app/models/user.rb
app/models/user.rb
+4
-4
db/migrate/20150620233230_add_default_otp_required_for_login_value.rb
...0150620233230_add_default_otp_required_for_login_value.rb
+9
-0
db/schema.rb
db/schema.rb
+2
-2
spec/models/user_spec.rb
spec/models/user_spec.rb
+2
-2
No files found.
app/models/user.rb
View file @
d3ff8c1a
...
...
@@ -50,12 +50,12 @@
# bitbucket_access_token :string(255)
# bitbucket_access_token_secret :string(255)
# location :string(255)
# public_email :string(255) default(""), not null
# encrypted_otp_secret :string(255)
# encrypted_otp_secret_iv :string(255)
# encrypted_otp_secret_salt :string(255)
# otp_required_for_login :boolean
# otp_required_for_login :boolean
default(FALSE), not null
# otp_backup_codes :text
# public_email :string(255) default(""), not null
# dashboard :integer default(0)
#
...
...
@@ -198,8 +198,8 @@ class User < ActiveRecord::Base
scope
:active
,
->
{
with_state
(
:active
)
}
scope
:not_in_project
,
->
(
project
)
{
project
.
users
.
present?
?
where
(
"id not in (:ids)"
,
ids:
project
.
users
.
map
(
&
:id
)
)
:
all
}
scope
:without_projects
,
->
{
where
(
'id NOT IN (SELECT DISTINCT(user_id) FROM members)'
)
}
scope
:with_two_factor
,
->
{
where
(
'otp_required_for_login IS true'
)
}
scope
:without_two_factor
,
->
{
where
(
'otp_required_for_login IS NOT true'
)
}
scope
:with_two_factor
,
->
{
where
(
otp_required_for_login:
true
)
}
scope
:without_two_factor
,
->
{
where
(
otp_required_for_login:
false
)
}
#
# Class methods
...
...
db/migrate/20150620233230_add_default_otp_required_for_login_value.rb
0 → 100644
View file @
d3ff8c1a
class
AddDefaultOtpRequiredForLoginValue
<
ActiveRecord
::
Migration
def
up
change_column
:users
,
:otp_required_for_login
,
:boolean
,
default:
false
,
null:
false
end
def
down
change_column
:users
,
:otp_required_for_login
,
:boolean
,
default:
nil
end
end
db/schema.rb
View file @
d3ff8c1a
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201506
10065936
)
do
ActiveRecord
::
Schema
.
define
(
version:
201506
20233230
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -499,7 +499,7 @@ ActiveRecord::Schema.define(version: 20150610065936) do
t
.
string
"encrypted_otp_secret"
t
.
string
"encrypted_otp_secret_iv"
t
.
string
"encrypted_otp_secret_salt"
t
.
boolean
"otp_required_for_login"
t
.
boolean
"otp_required_for_login"
,
default:
false
,
null:
false
t
.
text
"otp_backup_codes"
t
.
string
"public_email"
,
default:
""
,
null:
false
t
.
integer
"dashboard"
,
default:
0
...
...
spec/models/user_spec.rb
View file @
d3ff8c1a
...
...
@@ -50,12 +50,12 @@
# bitbucket_access_token :string(255)
# bitbucket_access_token_secret :string(255)
# location :string(255)
# public_email :string(255) default(""), not null
# encrypted_otp_secret :string(255)
# encrypted_otp_secret_iv :string(255)
# encrypted_otp_secret_salt :string(255)
# otp_required_for_login :boolean
# otp_required_for_login :boolean
default(FALSE), not null
# otp_backup_codes :text
# public_email :string(255) default(""), not null
# dashboard :integer default(0)
#
...
...
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