Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Example backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas SAUVAGE
Example backend
Merge requests
!4
Trying to implement openid
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Trying to implement openid
trying-to-implement-openid
into
main
Overview
0
Commits
12
Pipelines
9
Changes
18
Merged
Thomas SAUVAGE
requested to merge
trying-to-implement-openid
into
main
1 year ago
Overview
0
Commits
12
Pipelines
9
Changes
5
Expand
0
0
Merge request reports
Compare
version 5
version 8
bb56ee87
1 year ago
version 7
46b8e605
1 year ago
version 6
bf3a901a
1 year ago
version 5
22f5d852
1 year ago
version 4
ff6ac180
1 year ago
version 3
c9d56632
1 year ago
version 2
f89e3662
1 year ago
version 1
84ba8be7
1 year ago
main (base)
and
latest version
latest version
058280df
12 commits,
1 year ago
version 8
bb56ee87
11 commits,
1 year ago
version 7
46b8e605
10 commits,
1 year ago
version 6
bf3a901a
8 commits,
1 year ago
version 5
22f5d852
6 commits,
1 year ago
version 4
ff6ac180
5 commits,
1 year ago
version 3
c9d56632
4 commits,
1 year ago
version 2
f89e3662
3 commits,
1 year ago
version 1
84ba8be7
2 commits,
1 year ago
Show latest version
5 files
+
62
−
25
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
app/Controllers/auth/authNotSigmaUser.ts
+
8
−
6
Options
import
type
{
HttpContextContract
}
from
'
@ioc:Adonis/Core/HttpContext
'
import
NotSigma
User
from
'
App/Models/
NotSigma
User
'
import
User
from
'
App/Models/User
'
import
{
randomString
}
from
'
App/Utils/random
'
/** Login a user that is not using the CAS */
export
const
loginNotSigmaUser
=
async
({
request
,
response
,
auth
}:
HttpContextContract
)
=>
{
// TODO: Validate
?
// TODO: Validate
const
username
=
request
.
input
(
'
username
'
)
const
password
=
request
.
input
(
'
password
'
)
@@ -19,20 +19,22 @@ export const loginNotSigmaUser = async ({ request, response, auth }: HttpContext
/** Create a user that is not using the CAS */
export
const
createNotSigmaUser
=
async
({
request
,
response
}:
HttpContextContract
)
=>
{
// TODO: Validate
?
// TODO: Validate
const
username
=
request
.
input
(
'
username
'
)
const
name
=
request
.
input
(
'
name
'
)
const
password
=
randomString
(
20
)
// Check if user already exists
const
user
=
await
NotSigma
User
.
findBy
(
'
username
'
,
username
)
const
user
=
await
User
.
findBy
(
'
username
'
,
username
)
if
(
user
)
{
return
response
.
badRequest
({
error
:
'
User already exists
'
})
}
await
NotSigma
User
.
create
({
username
,
password
})
await
User
.
create
({
username
,
name
,
password
,
groups
:
[],
isAdmin
:
false
,
isSigmaUser
:
false
})
return
response
.
created
({
message
:
'
User created
'
,
username
,
password
})
return
response
.
created
({
message
:
'
User created
'
,
username
,
name
,
password
})
}
/** Remove an auth token */
Loading