more work
This commit is contained in:
parent
c068f2ca16
commit
7ff103a430
|
|
@ -19,4 +19,7 @@ module ValidationMessages
|
|||
INSTRUMENT_LIMIT_EXCEEDED = "No more than 5 instruments are allowed."
|
||||
INSTRUMENT_MINIMUM_NOT_MET = "At least 1 instrument is required."
|
||||
|
||||
# user
|
||||
OLD_PASSWORD_DOESNT_MATCH = "Your old password is incorrect."
|
||||
|
||||
end
|
||||
|
|
@ -164,6 +164,15 @@ module JamRuby
|
|||
return id
|
||||
end
|
||||
|
||||
def set_password(old_password, new_password)
|
||||
raise JamRuby::JamArgumentError, ValidationMessages::OLD_PASSWORD_DOESNT_MATCH unless authenticate old_password
|
||||
# FIXME: Should verify that the new password meets certain quality criteria
|
||||
# FIXME: Need to run the new password through the validations here. Not sure if this does that.
|
||||
password = new_password
|
||||
save
|
||||
end
|
||||
|
||||
|
||||
# helper method for creating / updating a User
|
||||
def self.save(id, updater_id, first_name, last_name, email, password, password_confirmation, musician, gender,
|
||||
birth_date, internet_service_provider, city, state, country, instruments, photo_url)
|
||||
|
|
|
|||
|
|
@ -125,6 +125,17 @@ describe User do
|
|||
it { should be_invalid }
|
||||
end
|
||||
|
||||
describe "setting a new password should work" do
|
||||
|
||||
end
|
||||
describe "setting a new password should fail if old one doesnt match" do
|
||||
|
||||
end
|
||||
describe "setting a new password should fail if new one doesnt validate" do
|
||||
|
||||
end
|
||||
|
||||
|
||||
describe "return value of authenticate method" do
|
||||
before { @user.save }
|
||||
let(:found_user) { User.find_by_email(@user.email) }
|
||||
|
|
|
|||
Loading…
Reference in New Issue