added back the tooltip explaining username constatrains on the accept invite flow
This commit is contained in:
parent
121c0c97f8
commit
2708b0b695
3 changed files with 26 additions and 13 deletions
|
|
@ -31,23 +31,25 @@ class InvitationsController < Devise::InvitationsController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
invitation_token = params[:user][:invitation_token]
|
invitation_token = params[:user][:invitation_token]
|
||||||
|
|
||||||
if invitation_token.nil? || invitation_token.blank?
|
if invitation_token.nil? || invitation_token.blank?
|
||||||
redirect_to :back, :error => I18n.t('invitations.check_token.not_found')
|
redirect_to :back, :error => I18n.t('invitations.check_token.not_found')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
user = User.find_by_invitation_token!(invitation_token)
|
user = User.find_by_invitation_token!(invitation_token)
|
||||||
|
|
||||||
user.accept_invitation!(params[:user])
|
|
||||||
|
|
||||||
if user.persisted? && user.person && user.person.persisted?
|
user.accept_invitation!(params[:user])
|
||||||
user.seed_aspects
|
|
||||||
flash[:notice] = I18n.t 'registrations.create.success'
|
if user.persisted? && user.person && user.person.persisted?
|
||||||
sign_in_and_redirect(:user, user)
|
user.seed_aspects
|
||||||
|
flash[:notice] = I18n.t 'registrations.create.success'
|
||||||
|
sign_in_and_redirect(:user, user)
|
||||||
else
|
else
|
||||||
redirect_to accept_user_invitation_path(:invitation_token => params[:user][:invitation_token]), :error => user.errors.full_messages.join(", ")
|
user.errors.delete(:person)
|
||||||
|
flash[:error] = user.errors.full_messages.join(", ")
|
||||||
|
redirect_to accept_user_invitation_path(:invitation_token => params[:user][:invitation_token])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
= javascript_include_tag "validation"
|
= javascript_include_tag "validation"
|
||||||
|
= javascript_tag "Diaspora.Page = 'InvitationsEdit';"
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#user_username").focus();
|
$("#user_username").focus();
|
||||||
|
|
@ -13,6 +15,8 @@
|
||||||
= t('.your_account_awaits')
|
= t('.your_account_awaits')
|
||||||
%h3.accept_invitation_text
|
%h3.accept_invitation_text
|
||||||
= t('.accept_your_invitation')
|
= t('.accept_your_invitation')
|
||||||
|
- flash.each do |name, msg|
|
||||||
|
%p{:class => "login_#{name}"}= msg
|
||||||
|
|
||||||
.span-10
|
.span-10
|
||||||
%br
|
%br
|
||||||
|
|
|
||||||
7
public/javascripts/pages/invitations-edit.js
Normal file
7
public/javascripts/pages/invitations-edit.js
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
Diaspora.Pages.InvitationsEdit = function() {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
this.subscribe("page/ready", function(evt, body) {
|
||||||
|
$('#user_username').tipsy({trigger: 'select', gravity: 'w'});
|
||||||
|
});
|
||||||
|
};
|
||||||
Loading…
Reference in a new issue