Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
diaspora
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
diasporg
diaspora
Commits
a2aabeb5
Commit
a2aabeb5
authored
Mar 16, 2012
by
Maxwell Salzberg
Committed by
danielgrippi
Mar 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove ActiveSupport::SecureRandom
parent
3c23364f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
15 additions
and
15 deletions
+15
-15
app/models/invitation_code.rb
app/models/invitation_code.rb
+1
-1
app/models/photo.rb
app/models/photo.rb
+1
-1
app/models/user.rb
app/models/user.rb
+2
-2
lib/diaspora/guid.rb
lib/diaspora/guid.rb
+1
-1
lib/tasks/generate_session_secret.rake
lib/tasks/generate_session_secret.rake
+1
-1
lib/tasks/heroku.rake
lib/tasks/heroku.rake
+1
-1
spec/factories.rb
spec/factories.rb
+3
-3
spec/models/services/twitter_spec.rb
spec/models/services/twitter_spec.rb
+4
-4
spec/models/user_spec.rb
spec/models/user_spec.rb
+1
-1
No files found.
app/models/invitation_code.rb
View file @
a2aabeb5
...
...
@@ -23,7 +23,7 @@ class InvitationCode < ActiveRecord::Base
def
generate_token
begin
self
.
token
=
ActiveSupport
::
SecureRandom
.
hex
(
6
)
self
.
token
=
SecureRandom
.
hex
(
6
)
end
while
InvitationCode
.
exists?
(
:token
=>
self
[
:token
])
end
...
...
app/models/photo.rb
View file @
a2aabeb5
...
...
@@ -71,7 +71,7 @@ class Photo < ActiveRecord::Base
photo
.
pending
=
params
[
:pending
]
if
params
[
:pending
]
photo
.
diaspora_handle
=
photo
.
author
.
diaspora_handle
photo
.
random_string
=
ActiveSupport
::
SecureRandom
.
hex
(
10
)
photo
.
random_string
=
SecureRandom
.
hex
(
10
)
if
params
[
:user_file
]
image_file
=
params
.
delete
(
:user_file
)
...
...
app/models/user.rb
View file @
a2aabeb5
...
...
@@ -438,7 +438,7 @@ class User < ActiveRecord::Base
self
.
unconfirmed_email
=
nil
if
unconfirmed_email
.
blank?
||
unconfirmed_email
==
email
if
unconfirmed_email_changed?
self
.
confirm_email_token
=
unconfirmed_email
?
ActiveSupport
::
SecureRandom
.
hex
(
15
)
:
nil
self
.
confirm_email_token
=
unconfirmed_email
?
SecureRandom
.
hex
(
15
)
:
nil
end
end
...
...
@@ -495,7 +495,7 @@ class User < ActiveRecord::Base
end
self
[
:email
]
=
"deletedaccount_
#{
self
[
:id
]
}
@example.org"
random_password
=
ActiveSupport
::
SecureRandom
.
hex
(
20
)
random_password
=
SecureRandom
.
hex
(
20
)
self
.
password
=
random_password
self
.
password_confirmation
=
random_password
self
.
save
(
:validate
=>
false
)
...
...
lib/diaspora/guid.rb
View file @
a2aabeb5
...
...
@@ -13,6 +13,6 @@ module Diaspora::Guid
# @return [String] The model's guid.
def
set_guid
self
.
guid
=
ActiveSupport
::
SecureRandom
.
hex
(
8
)
if
self
.
guid
.
blank?
self
.
guid
=
SecureRandom
.
hex
(
8
)
if
self
.
guid
.
blank?
end
end
lib/tasks/generate_session_secret.rake
View file @
a2aabeb5
...
...
@@ -3,7 +3,7 @@ namespace :generate do
task
:secret_token
do
path
=
File
.
join
(
Rails
.
root
,
'config'
,
'initializers'
,
'secret_token.rb'
)
secret
=
ActiveSupport
::
SecureRandom
.
hex
(
40
)
secret
=
SecureRandom
.
hex
(
40
)
File
.
open
(
path
,
'w'
)
do
|
f
|
f
.
write
<<
"EOF"
# Copyright (c) 2010-2011, Diaspora Inc. This file is
...
...
lib/tasks/heroku.rake
View file @
a2aabeb5
...
...
@@ -9,7 +9,7 @@ namespace :heroku do
task
:generate_secret_token
do
puts
"Generating and setting a new secret token"
token
=
ActiveSupport
::
SecureRandom
.
hex
(
40
)
#reloads secret token every time you reload vars.... this expires cookies, and kinda sucks
token
=
SecureRandom
.
hex
(
40
)
#reloads secret token every time you reload vars.... this expires cookies, and kinda sucks
command
=
"
#{
HEROKU_CONFIG_ADD_COMMAND
}
SECRET_TOKEN=
#{
token
}
"
puts
command
system
command
...
...
spec/factories.rb
View file @
a2aabeb5
...
...
@@ -7,7 +7,7 @@
# http://railscasts.com/episodes/158-factories-not-fixtures
def
r_str
ActiveSupport
::
SecureRandom
.
hex
(
3
)
SecureRandom
.
hex
(
3
)
end
FactoryGirl
.
define
do
...
...
@@ -100,7 +100,7 @@ FactoryGirl.define do
end
factory
(
:photo
)
do
sequence
(
:random_string
)
{
|
n
|
ActiveSupport
::
SecureRandom
.
hex
(
10
)
}
sequence
(
:random_string
)
{
|
n
|
SecureRandom
.
hex
(
10
)
}
association
:author
,
:factory
=>
:person
after_build
do
|
p
|
p
.
unprocessed_image
.
store!
File
.
open
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'fixtures'
,
'button.png'
))
...
...
@@ -237,7 +237,7 @@ FactoryGirl.define do
end
factory
(
:note
,
:parent
=>
:status_message
)
do
text
ActiveSupport
::
SecureRandom
.
hex
(
1000
)
text
SecureRandom
.
hex
(
1000
)
end
factory
(
:rich_media
,
:parent
=>
:status_message
)
do
...
...
spec/models/services/twitter_spec.rb
View file @
a2aabeb5
...
...
@@ -30,17 +30,17 @@ describe Services::Twitter do
end
describe
"message size limits"
do
before
:each
do
@long_message_start
=
ActiveSupport
::
SecureRandom
.
hex
(
25
)
@long_message_end
=
ActiveSupport
::
SecureRandom
.
hex
(
25
)
@long_message_start
=
SecureRandom
.
hex
(
25
)
@long_message_end
=
SecureRandom
.
hex
(
25
)
end
it
"should not truncate a short message"
do
short_message
=
ActiveSupport
::
SecureRandom
.
hex
(
20
)
short_message
=
SecureRandom
.
hex
(
20
)
short_post
=
stub
(
:text
=>
short_message
)
@service
.
public_message
(
short_post
,
''
).
should
==
short_message
end
it
"should truncate a long message"
do
long_message
=
ActiveSupport
::
SecureRandom
.
hex
(
220
)
long_message
=
SecureRandom
.
hex
(
220
)
long_post
=
stub
(
:text
=>
long_message
)
@service
.
public_message
(
long_post
,
''
).
should
==
long_message
.
first
(
137
)
+
"..."
end
...
...
spec/models/user_spec.rb
View file @
a2aabeb5
...
...
@@ -846,7 +846,7 @@ describe User do
describe
"#clear_account!"
do
it
'resets the password to a random string'
do
random_pass
=
"12345678909876543210"
ActiveSupport
::
SecureRandom
.
should_receive
(
:hex
).
and_return
(
random_pass
)
SecureRandom
.
should_receive
(
:hex
).
and_return
(
random_pass
)
@user
.
clear_account!
@user
.
valid_password?
(
random_pass
)
end
...
...
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