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
0b9e1e16
Commit
0b9e1e16
authored
Nov 21, 2017
by
Daniel Juarez
Committed by
Rémy Coutable
Nov 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip confirmation user api
parent
28a5f5f2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
1 deletion
+22
-1
app/models/user.rb
app/models/user.rb
+4
-0
changelogs/unreleased/skip_confirmation_user_API.yml
changelogs/unreleased/skip_confirmation_user_API.yml
+7
-0
doc/api/users.md
doc/api/users.md
+1
-0
lib/api/users.rb
lib/api/users.rb
+2
-1
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+8
-0
No files found.
app/models/user.rb
View file @
0b9e1e16
...
...
@@ -445,6 +445,10 @@ class User < ActiveRecord::Base
skip_confirmation!
if
bool
end
def
skip_reconfirmation
=
(
bool
)
skip_reconfirmation!
if
bool
end
def
generate_reset_token
@reset_token
,
enc
=
Devise
.
token_generator
.
generate
(
self
.
class
,
:reset_password_token
)
...
...
changelogs/unreleased/skip_confirmation_user_API.yml
0 → 100644
View file @
0b9e1e16
---
title
:
Add email confirmation parameters for user creation and update via API
merge_request
:
author
:
Daniel Juarez
type
:
added
doc/api/users.md
View file @
0b9e1e16
...
...
@@ -297,6 +297,7 @@ Parameters:
-
`location`
(optional) - User's location
-
`admin`
(optional) - User is admin - true or false (default)
-
`can_create_group`
(optional) - User can create groups - true or false
-
`skip_reconfirmation`
(optional) - Skip reconfirmation - true or false (default)
-
`external`
(optional) - Flags the user as external - true or false(default)
-
`avatar`
(optional) - Image file for user's avatar
...
...
lib/api/users.rb
View file @
0b9e1e16
...
...
@@ -31,7 +31,6 @@ module API
optional
:location
,
type:
String
,
desc:
'The location of the user'
optional
:admin
,
type:
Boolean
,
desc:
'Flag indicating the user is an administrator'
optional
:can_create_group
,
type:
Boolean
,
desc:
'Flag indicating the user can create groups'
optional
:skip_confirmation
,
type:
Boolean
,
default:
false
,
desc:
'Flag indicating the account is confirmed'
optional
:external
,
type:
Boolean
,
desc:
'Flag indicating the user is an external user'
optional
:avatar
,
type:
File
,
desc:
'Avatar image for user'
all_or_none_of
:extern_uid
,
:provider
...
...
@@ -101,6 +100,7 @@ module API
requires
:email
,
type:
String
,
desc:
'The email of the user'
optional
:password
,
type:
String
,
desc:
'The password of the new user'
optional
:reset_password
,
type:
Boolean
,
desc:
'Flag indicating the user will be sent a password reset token'
optional
:skip_confirmation
,
type:
Boolean
,
desc:
'Flag indicating the account is confirmed'
at_least_one_of
:password
,
:reset_password
requires
:name
,
type:
String
,
desc:
'The name of the user'
requires
:username
,
type:
String
,
desc:
'The username of the user'
...
...
@@ -134,6 +134,7 @@ module API
requires
:id
,
type:
Integer
,
desc:
'The ID of the user'
optional
:email
,
type:
String
,
desc:
'The email of the user'
optional
:password
,
type:
String
,
desc:
'The password of the new user'
optional
:skip_reconfirmation
,
type:
Boolean
,
desc:
'Flag indicating the account skips the confirmation by email'
optional
:name
,
type:
String
,
desc:
'The name of the user'
optional
:username
,
type:
String
,
desc:
'The username of the user'
use
:optional_attributes
...
...
spec/requests/api/users_spec.rb
View file @
0b9e1e16
...
...
@@ -510,6 +510,14 @@ describe API::Users do
expect
(
user
.
reload
.
notification_email
).
to
eq
(
'new@email.com'
)
end
it
'skips reconfirmation when requested'
do
put
api
(
"/users/
#{
user
.
id
}
"
,
admin
),
{
skip_reconfirmation:
true
}
user
.
reload
expect
(
user
.
confirmed_at
).
to
be_present
end
it
'updates user with his own username'
do
put
api
(
"/users/
#{
user
.
id
}
"
,
admin
),
username:
user
.
username
...
...
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