mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-07 08:21:47 +01:00
Users with SHA-1 hashes are redirected to the password change page
This commit is contained in:
parent
a11937788e
commit
5d3829cfbf
6 changed files with 54 additions and 0 deletions
|
|
@ -104,6 +104,8 @@ module NavigationHelpers
|
|||
when /the tag page for "([^"]*)"/i
|
||||
@source_view = "tag"
|
||||
tag_path($1, options)
|
||||
when /the change password page/
|
||||
change_password_user_path @current_user
|
||||
|
||||
# Add more mappings here.
|
||||
# Here is an example that pulls values out of the Regexp:
|
||||
|
|
|
|||
18
features/support/user.rb
Normal file
18
features/support/user.rb
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
class User
|
||||
# A method used in features' user records definitions. It accepts a string
|
||||
# with a password and the name of a hashing algorithm ('sha1' or 'bcrypt')
|
||||
# concatenated with a space. It encrypts user's password using the given
|
||||
# mechanism and the given password value.
|
||||
def password_with_algorithm=(x)
|
||||
pass, algorithm = *x.split
|
||||
case algorithm
|
||||
when 'bcrypt'
|
||||
change_password pass, pass
|
||||
when 'sha1'
|
||||
self.crypted_password = User.sha1 pass
|
||||
self.password = self.password_confirmation = nil
|
||||
else
|
||||
raise "Unknown hashing algorithm: #{algorithm}"
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue