Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
X
xpub-faraday
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
xpub
xpub-faraday
Commits
3dbfa9cd
Commit
3dbfa9cd
authored
6 years ago
by
Sebastian Mihalache
Browse files
Options
Downloads
Patches
Plain Diff
feat(component-user-manager): add change password
parent
1d1143b2
No related branches found
No related tags found
1 merge request
!14
Sprint #15
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/component-fixture-manager/src/fixtures/users.js
+7
-1
7 additions, 1 deletion
packages/component-fixture-manager/src/fixtures/users.js
packages/component-user-manager/src/Users.js
+35
-0
35 additions, 0 deletions
packages/component-user-manager/src/Users.js
with
42 additions
and
1 deletion
packages/component-fixture-manager/src/fixtures/users.js
+
7
−
1
View file @
3dbfa9cd
...
...
@@ -81,11 +81,17 @@ const users = {
lastName
:
user
.
lastName
,
affiliation
:
chance
.
company
(),
title
:
'
Mr
'
,
save
:
jest
.
fn
(()
=>
users
.
user
),
save
:
jest
.
fn
(
function
save
()
{
return
this
}),
isConfirmed
:
false
,
updateProperties
:
jest
.
fn
(()
=>
users
.
user
),
teams
:
[],
confirmationToken
:
chance
.
hash
(),
validPassword
:
jest
.
fn
(
function
validPassword
(
password
)
{
return
this
.
password
===
password
}),
token
:
chance
.
hash
(),
},
author
:
{
type
:
'
user
'
,
...
...
This diff is collapsed.
Click to expand it.
packages/component-user-manager/src/Users.js
+
35
−
0
View file @
3dbfa9cd
...
...
@@ -2,6 +2,9 @@ const bodyParser = require('body-parser')
const
Invite
=
app
=>
{
app
.
use
(
bodyParser
.
json
())
const
authBearer
=
app
.
locals
.
passport
.
authenticate
(
'
bearer
'
,
{
session
:
false
,
})
/**
* @api {post} /api/users/reset-password Reset password
* @apiGroup Users
...
...
@@ -88,6 +91,38 @@ const Invite = app => {
'
/api/users/forgot-password
'
,
require
(
'
./routes/users/forgotPassword
'
)(
app
.
locals
.
models
),
)
/**
* @api {post} /api/users/change-password Change password
* @apiGroup Users
* @apiParamExample {json} Body
* {
* "password": "currentPassword",
* "newPassword": "newPassword",
* }
* @apiSuccessExample {json} Success
* HTTP/1.1 200 OK
* {
* "id": "a6184463-b17a-42f8-b02b-ae1d755cdc6b",
* "type": "user",
* "admin": false,
* "email": "email@example.com",
* "teams": [],
* "username": "email@example.com",
* "fragments": [],
* "collections": [],
* "isConfirmed": true,
* "editorInChief": false,
* "handlingEditor": false
* }
* @apiErrorExample {json} Reset password errors
* HTTP/1.1 400 Bad Request
* HTTP/1.1 404 Not Found
*/
app
.
post
(
'
/api/users/change-password
'
,
authBearer
,
require
(
'
./routes/users/changePassword
'
)(
app
.
locals
.
models
),
)
}
module
.
exports
=
Invite
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment