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
Léo-Paul Géneau
gitlab-ce
Commits
9f9be175
Commit
9f9be175
authored
Oct 15, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/confirmable' of /home/git/repositories/gitlab/gitlabhq
parents
db7d1549
f4d68f39
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
48 additions
and
6 deletions
+48
-6
CHANGELOG
CHANGELOG
+2
-0
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+2
-0
app/models/user.rb
app/models/user.rb
+2
-2
app/views/profiles/show.html.haml
app/views/profiles/show.html.haml
+6
-1
config/initializers/devise.rb
config/initializers/devise.rb
+2
-0
db/migrate/20131009115346_add_confirmable_to_users.rb
db/migrate/20131009115346_add_confirmable_to_users.rb
+15
-0
db/schema.rb
db/schema.rb
+6
-1
lib/gitlab/oauth/user.rb
lib/gitlab/oauth/user.rb
+1
-0
spec/factories.rb
spec/factories.rb
+4
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+8
-2
No files found.
CHANGELOG
View file @
9f9be175
...
@@ -17,6 +17,8 @@ v 6.2.0
...
@@ -17,6 +17,8 @@ v 6.2.0
- Avatar upload on profile page with a maximum of 200KB (Steven Thonus)
- Avatar upload on profile page with a maximum of 200KB (Steven Thonus)
- Store the sessions in Redis instead of the cookie store
- Store the sessions in Redis instead of the cookie store
- Fixed relative links in markdown
- Fixed relative links in markdown
- User must confirm his email if signup enabled
- User must confirm changed email
v 6.1.0
v 6.1.0
- Project specific IDs for issues, mr, milestones
- Project specific IDs for issues, mr, milestones
...
...
app/controllers/admin/users_controller.rb
View file @
9f9be175
...
@@ -47,6 +47,7 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -47,6 +47,7 @@ class Admin::UsersController < Admin::ApplicationController
@user
=
User
.
build_user
(
params
[
:user
].
merge
(
opts
),
as: :admin
)
@user
=
User
.
build_user
(
params
[
:user
].
merge
(
opts
),
as: :admin
)
@user
.
admin
=
(
admin
&&
admin
.
to_i
>
0
)
@user
.
admin
=
(
admin
&&
admin
.
to_i
>
0
)
@user
.
created_by_id
=
current_user
.
id
@user
.
created_by_id
=
current_user
.
id
@user
.
confirm!
respond_to
do
|
format
|
respond_to
do
|
format
|
if
@user
.
save
if
@user
.
save
...
@@ -71,6 +72,7 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -71,6 +72,7 @@ class Admin::UsersController < Admin::ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
if
user
.
update_attributes
(
params
[
:user
],
as: :admin
)
if
user
.
update_attributes
(
params
[
:user
],
as: :admin
)
user
.
confirm!
format
.
html
{
redirect_to
[
:admin
,
user
],
notice:
'User was successfully updated.'
}
format
.
html
{
redirect_to
[
:admin
,
user
],
notice:
'User was successfully updated.'
}
format
.
json
{
head
:ok
}
format
.
json
{
head
:ok
}
else
else
...
...
app/models/user.rb
View file @
9f9be175
...
@@ -43,7 +43,7 @@ require 'file_size_validator'
...
@@ -43,7 +43,7 @@ require 'file_size_validator'
class
User
<
ActiveRecord
::
Base
class
User
<
ActiveRecord
::
Base
devise
:database_authenticatable
,
:token_authenticatable
,
:lockable
,
:async
,
devise
:database_authenticatable
,
:token_authenticatable
,
:lockable
,
:async
,
:recoverable
,
:rememberable
,
:trackable
,
:validatable
,
:omniauthable
,
:registerable
:recoverable
,
:rememberable
,
:trackable
,
:validatable
,
:omniauthable
,
:
confirmable
,
:
registerable
attr_accessible
:email
,
:password
,
:password_confirmation
,
:remember_me
,
:bio
,
:name
,
:username
,
attr_accessible
:email
,
:password
,
:password_confirmation
,
:remember_me
,
:bio
,
:name
,
:username
,
:skype
,
:linkedin
,
:twitter
,
:color_scheme_id
,
:theme_id
,
:force_random_password
,
:skype
,
:linkedin
,
:twitter
,
:color_scheme_id
,
:theme_id
,
:force_random_password
,
...
@@ -398,4 +398,4 @@ class User < ActiveRecord::Base
...
@@ -398,4 +398,4 @@ class User < ActiveRecord::Base
self
self
end
end
end
end
\ No newline at end of file
app/views/profiles/show.html.haml
View file @
9f9be175
...
@@ -25,7 +25,12 @@
...
@@ -25,7 +25,12 @@
=
f
.
label
:email
,
class:
"control-label"
=
f
.
label
:email
,
class:
"control-label"
.controls
.controls
=
f
.
text_field
:email
,
class:
"input-xlarge"
,
required:
true
=
f
.
text_field
:email
,
class:
"input-xlarge"
,
required:
true
%span
.help-block
We also use email for avatar detection if no avatar is uploaded.
-
if
@user
.
unconfirmed_email
.
present?
%span
.help-block
We sent confirmation email to
%strong
#{
@user
.
unconfirmed_email
}
-
else
%span
.help-block
We also use email for avatar detection if no avatar is uploaded.
.control-group
.control-group
=
f
.
label
:skype
,
class:
"control-label"
=
f
.
label
:skype
,
class:
"control-label"
.controls
=
f
.
text_field
:skype
,
class:
"input-xlarge"
.controls
=
f
.
text_field
:skype
,
class:
"input-xlarge"
...
...
config/initializers/devise.rb
View file @
9f9be175
...
@@ -54,6 +54,8 @@ Devise.setup do |config|
...
@@ -54,6 +54,8 @@ Devise.setup do |config|
# The realm used in Http Basic Authentication. "Application" by default.
# The realm used in Http Basic Authentication. "Application" by default.
# config.http_authentication_realm = "Application"
# config.http_authentication_realm = "Application"
config
.
reconfirmable
=
true
# It will change confirmation, password recovery and other workflows
# It will change confirmation, password recovery and other workflows
# to behave the same regardless if the e-mail provided was right or wrong.
# to behave the same regardless if the e-mail provided was right or wrong.
# Does not affect registerable.
# Does not affect registerable.
...
...
db/migrate/20131009115346_add_confirmable_to_users.rb
0 → 100644
View file @
9f9be175
class
AddConfirmableToUsers
<
ActiveRecord
::
Migration
def
self
.
up
add_column
:users
,
:confirmation_token
,
:string
add_column
:users
,
:confirmed_at
,
:datetime
add_column
:users
,
:confirmation_sent_at
,
:datetime
add_column
:users
,
:unconfirmed_email
,
:string
add_index
:users
,
:confirmation_token
,
unique:
true
User
.
update_all
(
confirmed_at:
Time
.
now
)
end
def
self
.
down
remove_column
:users
,
:confirmation_token
,
:confirmed_at
,
:confirmation_sent_at
remove_column
:users
,
:unconfirmed_email
end
end
db/schema.rb
View file @
9f9be175
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# It's strongly recommended to check this file into your version control system.
# It's strongly recommended to check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
:version
=>
2013100
5191208
)
do
ActiveRecord
::
Schema
.
define
(
:version
=>
2013100
9115346
)
do
create_table
"deploy_keys_projects"
,
:force
=>
true
do
|
t
|
create_table
"deploy_keys_projects"
,
:force
=>
true
do
|
t
|
t
.
integer
"deploy_key_id"
,
:null
=>
false
t
.
integer
"deploy_key_id"
,
:null
=>
false
...
@@ -284,10 +284,15 @@ ActiveRecord::Schema.define(:version => 20131005191208) do
...
@@ -284,10 +284,15 @@ ActiveRecord::Schema.define(:version => 20131005191208) do
t
.
datetime
"password_expires_at"
t
.
datetime
"password_expires_at"
t
.
integer
"created_by_id"
t
.
integer
"created_by_id"
t
.
string
"avatar"
t
.
string
"avatar"
t
.
string
"confirmation_token"
t
.
datetime
"confirmed_at"
t
.
datetime
"confirmation_sent_at"
t
.
string
"unconfirmed_email"
end
end
add_index
"users"
,
[
"admin"
],
:name
=>
"index_users_on_admin"
add_index
"users"
,
[
"admin"
],
:name
=>
"index_users_on_admin"
add_index
"users"
,
[
"authentication_token"
],
:name
=>
"index_users_on_authentication_token"
,
:unique
=>
true
add_index
"users"
,
[
"authentication_token"
],
:name
=>
"index_users_on_authentication_token"
,
:unique
=>
true
add_index
"users"
,
[
"confirmation_token"
],
:name
=>
"index_users_on_confirmation_token"
,
:unique
=>
true
add_index
"users"
,
[
"email"
],
:name
=>
"index_users_on_email"
,
:unique
=>
true
add_index
"users"
,
[
"email"
],
:name
=>
"index_users_on_email"
,
:unique
=>
true
add_index
"users"
,
[
"extern_uid"
,
"provider"
],
:name
=>
"index_users_on_extern_uid_and_provider"
,
:unique
=>
true
add_index
"users"
,
[
"extern_uid"
,
"provider"
],
:name
=>
"index_users_on_extern_uid_and_provider"
,
:unique
=>
true
add_index
"users"
,
[
"name"
],
:name
=>
"index_users_on_name"
add_index
"users"
,
[
"name"
],
:name
=>
"index_users_on_name"
...
...
lib/gitlab/oauth/user.rb
View file @
9f9be175
...
@@ -29,6 +29,7 @@ module Gitlab
...
@@ -29,6 +29,7 @@ module Gitlab
user
=
model
.
build_user
(
opts
,
as: :admin
)
user
=
model
.
build_user
(
opts
,
as: :admin
)
user
.
save!
user
.
save!
user
.
confirm!
log
.
info
"(OAuth) Creating user
#{
email
}
from login with extern_uid =>
#{
uid
}
"
log
.
info
"(OAuth) Creating user
#{
email
}
from login with extern_uid =>
#{
uid
}
"
if
Gitlab
.
config
.
omniauth
[
'block_auto_created_users'
]
&&
!
ldap?
if
Gitlab
.
config
.
omniauth
[
'block_auto_created_users'
]
&&
!
ldap?
...
...
spec/factories.rb
View file @
9f9be175
...
@@ -23,6 +23,10 @@ FactoryGirl.define do
...
@@ -23,6 +23,10 @@ FactoryGirl.define do
end
end
factory
:admin
,
traits:
[
:admin
]
factory
:admin
,
traits:
[
:admin
]
after
:create
do
|
u
|
u
.
confirm!
end
end
end
factory
:project
do
factory
:project
do
...
...
spec/models/project_spec.rb
View file @
9f9be175
...
@@ -27,8 +27,14 @@
...
@@ -27,8 +27,14 @@
require
'spec_helper'
require
'spec_helper'
describe
Project
do
describe
Project
do
before
(
:each
)
{
enable_observers
}
let
(
:user
)
{
create
(
:user
)
}
after
(
:each
)
{
disable_observers
}
before
do
enable_observers
Thread
.
current
[
:current_user
]
=
user
end
after
{
disable_observers
}
describe
"Associations"
do
describe
"Associations"
do
it
{
should
belong_to
(
:group
)
}
it
{
should
belong_to
(
:group
)
}
...
...
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