Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
open-build-service-debian
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
obs
open-build-service-debian
Commits
63621996
Verified
Commit
63621996
authored
8 years ago
by
Björn Geuken
Committed by
Andrej Shadura
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[api] Use SecureRandom to generate a random fake password
Cherry-pick from
7967fe46
parent
d6929fd4
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!21
OBS SSO implementation
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/api/app/models/user.rb
+3
-6
3 additions, 6 deletions
src/api/app/models/user.rb
with
3 additions
and
6 deletions
src/api/app/models/user.rb
+
3
−
6
View file @
63621996
...
...
@@ -218,14 +218,11 @@ class User < ActiveRecord::Base
end
def
self
.
create_user_with_fake_pw!
(
attributes
=
{})
chars
=
[
"A"
..
"Z"
,
"a"
..
"z"
,
"0"
..
"9"
].
collect
(
&
:to_a
).
join
fakepw
=
(
1
..
24
).
collect
{
chars
[
rand
(
chars
.
size
)]
}.
pack
(
"a"
*
24
)
attributes
[
:password
]
=
fakepw
create!
(
attributes
)
# Generate and store a 24 char fake pw in the OBS DB that no-one knows
password
=
SecureRandom
.
base64
create!
(
attributes
.
merge
(
password:
password
,
password_confirmation:
password
))
end
# This static method tries to find a user with the given login and password
# in the database. Returns the user or nil if he could not be found
def
self
.
find_with_credentials
(
login
,
password
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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