setting the token to nil on accept of invite
This commit is contained in:
parent
9b249281a1
commit
324f14c719
4 changed files with 59 additions and 73 deletions
|
|
@ -266,8 +266,7 @@ class User
|
|||
end
|
||||
end
|
||||
|
||||
###Helpers############
|
||||
|
||||
###Invitations############
|
||||
def accept_invitation!( opts = {} )
|
||||
if self.invited?
|
||||
self.username = opts[:username]
|
||||
|
|
@ -283,11 +282,13 @@ class User
|
|||
person_hash = opts.delete(:person)
|
||||
self.person = Person.create(person_hash)
|
||||
self.person.save
|
||||
self.invitation_token = nil
|
||||
self.save
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
###Helpers############
|
||||
def self.instantiate!( opts = {} )
|
||||
opts[:person][:diaspora_handle] = "#{opts[:username]}@#{APP_CONFIG[:terse_pod_url]}"
|
||||
opts[:person][:url] = APP_CONFIG[:pod_url]
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
en:
|
||||
errors:
|
||||
messages:
|
||||
not_found: "not found"
|
||||
already_confirmed: "was already confirmed"
|
||||
not_locked: "was not locked"
|
||||
|
||||
devise:
|
||||
failure:
|
||||
unauthenticated: 'You need to sign in or sign up before continuing.'
|
||||
unconfirmed: 'You have to confirm your account before continuing.'
|
||||
locked: 'Your account is locked.'
|
||||
invalid: 'Invalid email or password.'
|
||||
invalid_token: 'Invalid authentication token.'
|
||||
timeout: 'Your session expired, please sign in again to continue.'
|
||||
inactive: 'Your account was not activated yet.'
|
||||
sessions:
|
||||
signed_in: 'Signed in successfully.'
|
||||
signed_out: 'Signed out successfully.'
|
||||
passwords:
|
||||
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
|
||||
updated: 'Your password was changed successfully. You are now signed in.'
|
||||
confirmations:
|
||||
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
|
||||
confirmed: 'Your account was successfully confirmed. You are now signed in.'
|
||||
registrations:
|
||||
signed_up: 'You have signed up successfully. If enabled, a confirmation was sent to your e-mail.'
|
||||
updated: 'You updated your account successfully.'
|
||||
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
|
||||
unlocks:
|
||||
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
|
||||
unlocked: 'Your account was successfully unlocked. You are now signed in.'
|
||||
invitations:
|
||||
send_instructions: 'Your invitation has been sent.'
|
||||
invitation_token_invalid: 'The invitation token provided is not valid!'
|
||||
updated: 'Your password was set successfully. You are now signed in.'
|
||||
mailer:
|
||||
confirmation_instructions:
|
||||
subject: 'Confirmation instructions'
|
||||
reset_password_instructions:
|
||||
subject: 'Reset password instructions'
|
||||
unlock_instructions:
|
||||
subject: 'Unlock Instructions'
|
||||
invitation:
|
||||
subject: 'A friend wants you to join Diaspora!'
|
||||
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
en:
|
||||
errors:
|
||||
messages:
|
||||
|
|
@ -11,30 +7,40 @@ en:
|
|||
|
||||
devise:
|
||||
failure:
|
||||
unauthenticated: "You need to sign in or sign up before continuing."
|
||||
unconfirmed: "You have to confirm your account before continuing."
|
||||
locked: "Your account is locked."
|
||||
invalid: "Invalid email or password."
|
||||
invalid_token: "Invalid authentication token."
|
||||
timeout: "Your session expired, please sign in again to continue."
|
||||
inactive: "Your account was not activated yet."
|
||||
unauthenticated: 'You need to sign in or sign up before continuing.'
|
||||
unconfirmed: 'You have to confirm your account before continuing.'
|
||||
locked: 'Your account is locked.'
|
||||
invalid: 'Invalid email or password.'
|
||||
invalid_token: 'Invalid authentication token.'
|
||||
timeout: 'Your session expired, please sign in again to continue.'
|
||||
inactive: 'Your account was not activated yet.'
|
||||
sessions:
|
||||
signed_in: "Signed in successfully."
|
||||
signed_out: "Signed out successfully."
|
||||
signed_in: 'Signed in successfully.'
|
||||
signed_out: 'Signed out successfully.'
|
||||
passwords:
|
||||
send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes."
|
||||
updated: "Your password was changed successfully. You are now signed in."
|
||||
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
|
||||
updated: 'Your password was changed successfully. You are now signed in.'
|
||||
confirmations:
|
||||
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
|
||||
confirmed: "Your account was successfully confirmed. You are now signed in."
|
||||
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
|
||||
confirmed: 'Your account was successfully confirmed. You are now signed in.'
|
||||
registrations:
|
||||
signed_up: "You have signed up successfully. If enabled, a confirmation was sent to your e-mail."
|
||||
updated: "You updated your account successfully."
|
||||
destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
|
||||
signed_up: 'You have signed up successfully. If enabled, a confirmation was sent to your e-mail.'
|
||||
updated: 'You updated your account successfully.'
|
||||
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
|
||||
unlocks:
|
||||
send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
|
||||
unlocked: "Your account was successfully unlocked. You are now signed in."
|
||||
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
|
||||
unlocked: 'Your account was successfully unlocked. You are now signed in.'
|
||||
invitations:
|
||||
send_instructions: 'Your invitation has been sent.'
|
||||
invitation_token_invalid: 'The invitation token provided is not valid!'
|
||||
updated: 'Your password was set successfully. You are now signed in.'
|
||||
mailer:
|
||||
confirmation_instructions: "Confirmation instructions"
|
||||
reset_password_instructions: "Reset password instructions"
|
||||
unlock_instructions: "Unlock Instructions"
|
||||
confirmation_instructions:
|
||||
subject: 'Confirmation instructions'
|
||||
reset_password_instructions:
|
||||
subject: 'Reset password instructions'
|
||||
unlock_instructions:
|
||||
subject: 'Unlock Instructions'
|
||||
invitation:
|
||||
subject: 'A friend wants you to join Diaspora!'
|
||||
|
||||
|
|
|
|||
25
spec/controllers/invitations_controller_spec.rb
Normal file
25
spec/controllers/invitations_controller_spec.rb
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe InvitationsController do
|
||||
render_views
|
||||
let(:user) {Factory.create :user}
|
||||
|
||||
before do
|
||||
sign_in :user, user
|
||||
end
|
||||
|
||||
context 'inviting another user' do
|
||||
it 'should create an invited user and add keep track of an invitor' do
|
||||
debugger
|
||||
params = {"user" => {"email" => "test@example.com"}}
|
||||
post :create, params
|
||||
#invitee = inviter.invite_user(:email => "test@example.com")
|
||||
#invitee.inviters.includes?(inviter).should be true
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Reference in a new issue