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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
0c1ccda4
Commit
0c1ccda4
authored
Jul 29, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add "Confirm user" button in user admin page
Closes #2116 Closes
https://github.com/gitlabhq/gitlabhq/issues/9502
parent
4c9ba632
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
0 deletions
+47
-0
CHANGELOG
CHANGELOG
+1
-0
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+8
-0
app/views/admin/users/show.html.haml
app/views/admin/users/show.html.haml
+10
-0
config/routes.rb
config/routes.rb
+1
-0
spec/controllers/admin/users_controller_spec.rb
spec/controllers/admin/users_controller_spec.rb
+14
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+13
-0
No files found.
CHANGELOG
View file @
0c1ccda4
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 7.14.0 (unreleased)
v 7.14.0 (unreleased)
- Fix multi-line syntax highlighting (Stan Hu)
- Fix multi-line syntax highlighting (Stan Hu)
- Fix network graph when branch name has single quotes (Stan Hu)
- Fix network graph when branch name has single quotes (Stan Hu)
- Add "Confirm user" button in user admin page (Stan Hu)
- Upgrade gitlab_git to version 7.2.6 to fix Error 500 when creating network graphs (Stan Hu)
- Upgrade gitlab_git to version 7.2.6 to fix Error 500 when creating network graphs (Stan Hu)
- Add support for Unicode filenames in relative links (Hiroyuki Sato)
- Add support for Unicode filenames in relative links (Hiroyuki Sato)
- Fix URL used for refreshing notes if relative_url is present (Bartłomiej Święcki)
- Fix URL used for refreshing notes if relative_url is present (Bartłomiej Święcki)
...
...
app/controllers/admin/users_controller.rb
View file @
0c1ccda4
...
@@ -55,6 +55,14 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -55,6 +55,14 @@ class Admin::UsersController < Admin::ApplicationController
end
end
end
end
def
confirm
if
user
.
confirm!
redirect_to
:back
,
notice:
"Successfully confirmed"
else
redirect_to
:back
,
alert:
"Error occurred. User was not confirmed"
end
end
def
disable_two_factor
def
disable_two_factor
user
.
disable_two_factor!
user
.
disable_two_factor!
redirect_to
admin_user_path
(
user
),
redirect_to
admin_user_path
(
user
),
...
...
app/views/admin/users/show.html.haml
View file @
0c1ccda4
...
@@ -105,6 +105,16 @@
...
@@ -105,6 +105,16 @@
.col-md-6
.col-md-6
-
unless
@user
==
current_user
-
unless
@user
==
current_user
-
unless
@user
.
confirmed?
.panel.panel-info
.panel-heading
Confirm user
.panel-body
-
if
@user
.
unconfirmed_email
.
present?
-
email
=
" (
#{
@user
.
unconfirmed_email
}
)"
%p
This user has an unconfirmed email address
#{
email
}
. You may force a confirmation.
%br
=
link_to
'Confirm user'
,
confirm_admin_user_path
(
@user
),
method: :put
,
class:
"btn btn-info"
,
data:
{
confirm:
'Are you sure?'
}
-
if
@user
.
blocked?
-
if
@user
.
blocked?
.panel.panel-info
.panel.panel-info
.panel-heading
.panel-heading
...
...
config/routes.rb
View file @
0c1ccda4
...
@@ -159,6 +159,7 @@ Gitlab::Application.routes.draw do
...
@@ -159,6 +159,7 @@ Gitlab::Application.routes.draw do
put
:block
put
:block
put
:unblock
put
:unblock
put
:unlock
put
:unlock
put
:confirm
patch
:disable_two_factor
patch
:disable_two_factor
delete
'remove/:email_id'
,
action:
'remove_email'
,
as:
'remove_email'
delete
'remove/:email_id'
,
action:
'remove_email'
,
as:
'remove_email'
end
end
...
...
spec/controllers/admin/users_controller_spec.rb
View file @
0c1ccda4
...
@@ -37,6 +37,20 @@ describe Admin::UsersController do
...
@@ -37,6 +37,20 @@ describe Admin::UsersController do
end
end
end
end
describe
'PUT confirm/:id'
do
let
(
:user
)
{
create
(
:user
,
confirmed_at:
nil
)
}
before
do
request
.
env
[
"HTTP_REFERER"
]
=
"/"
end
it
'confirms user'
do
put
:confirm
,
id:
user
.
username
user
.
reload
expect
(
user
.
confirmed?
).
to
be_truthy
end
end
describe
'PATCH disable_two_factor'
do
describe
'PATCH disable_two_factor'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
...
...
spec/models/user_spec.rb
View file @
0c1ccda4
...
@@ -184,6 +184,19 @@ describe User do
...
@@ -184,6 +184,19 @@ describe User do
it
{
is_expected
.
to
respond_to
(
:private_token
)
}
it
{
is_expected
.
to
respond_to
(
:private_token
)
}
end
end
describe
'#confirm'
do
let
(
:user
)
{
create
(
:user
,
confirmed_at:
nil
,
unconfirmed_email:
'test@gitlab.com'
)
}
it
'returns unconfirmed'
do
expect
(
user
.
confirmed?
).
to
be_falsey
end
it
'confirms a user'
do
user
.
confirm!
expect
(
user
.
confirmed?
).
to
be_truthy
end
end
describe
'#to_reference'
do
describe
'#to_reference'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
...
...
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