Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating name doesn't work #155

Open
f2prateek opened this issue Nov 18, 2015 · 30 comments · May be fixed by CocoaPods/cocoapods-trunk#92
Open

Updating name doesn't work #155

f2prateek opened this issue Nov 18, 2015 · 30 comments · May be fixed by CocoaPods/cocoapods-trunk#92

Comments

@f2prateek
Copy link

I accidentally used the wrong name when I was setting up CocoaPods. It seems that simply registering again with a new name should let me update it (

def self.find_or_initialize_by_email_and_update_name(email, name)
if owner = Owner.find_by_email(email)
owner.name = name unless name.blank?
owner
else
Owner.new(:email => email, :name => name)
end
end
), but doesn't seem to be working with CocoaPods 0.39.0.

image

@segiddins
Copy link
Member

@f2prateek
Copy link
Author

Hmm... is this specific to my account, or are you able to reproduce it for yours as well?

@segiddins
Copy link
Member

I haven't tried to reproduce it yet, but I did a quick audit of the code and it all seems in order

@chiulam
Copy link

chiulam commented Jan 5, 2016

I got the same problem.
Want to change my account by register again, but fail.

@alloy
Copy link
Member

alloy commented Jan 5, 2016

Might be related to #150 ?

@hohl
Copy link

hohl commented Mar 17, 2016

Accidentally had an typo in my name and would like to fix it. Any chance to change my name? Re-registring with the correct name doesn't change anything.

@ipavlidakis
Copy link

Same problem for me also here. Any chance to get an update functionality?

@orta
Copy link
Member

orta commented Jun 21, 2016

You're welcome to take a look at fixing it, this repo is well tested

@lengain
Copy link

lengain commented Jul 25, 2016

Re-registring with the correct name doesn't change anything.

@meilbn
Copy link

meilbn commented Oct 18, 2016

This problem is still there with CocoaPods 1.0.1, I register wrong name with Pod name, so I want changing it, but it's not working by pod trunk register EMAIL 'New Name', and the pod trunk register --help print:
If this is your first registration, both an EMAIL address and your NAME are required. If you’ve already registered with trunk, you may omit the NAME (unless you would like to change it).

I tried several times, but all failed, then I register new trunk with my another email, it seems like only first time register will setting name.

@katejaiheelee2
Copy link

Anybody found a workaround for this issue?

@tallytalwar
Copy link

Yeah this is still not working. Is there any work around we can use for the time being?

@lstemerdink
Copy link

Hello @orta,

Seeing that many people are still running into this issue, could you provide us with an update as to what is the status of this issue? I would like to fix a naming error that I made whilst setting up a session with trunk.
I read in another thread concerning this same issue that "pod trunk register will create a new account with the new email, not re-name it.". If this is indeed the case I suggest to change the misleading sentence in the description of the register command. However I would prefer to have the functionality of changing registered name, probably along with all the other CocoaPod users that voiced themselves in this thread and many more.

@orta
Copy link
Member

orta commented Feb 17, 2017

As I've mentioned, we've taken a look over it and couldn't find any obvious answers. You're welcome to take a look at figuring it out and writing a PR fixing it 👍

We work on CocoaPods in our spare time, so there is no schedule for fixing it and as this is the canonical issue for the problem - so any notes from others looking at it would go here

@scinfu
Copy link

scinfu commented Apr 6, 2017

Any news?

@orta
Copy link
Member

orta commented Apr 6, 2017

Nope, otherwise there would be a mention in this issue.

@paynerc
Copy link

paynerc commented Apr 27, 2017

The issue is here: https://github.com/CocoaPods/trunk.cocoapods.org/blob/master/app/controllers/api/sessions_controller.rb#L12

When you run the pod trunk register command, it doesn't include the Authorization header, therefore @owner will never be present.

After looking over this, I think this code is correct. I don't want any random person being able to submit a session registration for an already existing owner and then go about changing the name. If you took this check out of here, that would allow anybody to be able to do that.

The fix for this needs to happen in the pod trunk register command itself. I'm guessing if you already have a valid active session, pass the auth header when you make subsequent registrations, and it will enable the functionality.

To test that theory I submitted the following curl:

curl -v -H "Authorization: Token <MY CURRENT TOKEN>" -H "Content-Type: application/json" -X POST -d '{"email":"<MY EMAIL>","name":"<MY NEW NAME>","description":"<My DESCRIPTION>"}' https://trunk.cocoapods.org/api/v1/sessions 

And it properly updated the name to <MY NEW NAME>.

@tallytalwar
Copy link

@paynerc greatness. Thanks a ton. Works superb.

For those looking for your Authorization Token. Once you are in a cocoapod session, do the following:

grep -A2 'trunk.cocoapods.org' ~/.netrc

@meilbn
Copy link

meilbn commented Apr 28, 2017

@tallytalwar This command just print:

machine trunk.cocoapods.org
  login My Email
  password ******

Is password is the Token?

Thanks!

@tallytalwar
Copy link

Yup password is the token

@meilbn
Copy link

meilbn commented Apr 28, 2017

@tallytalwar Thanks!
But...Are you changed your name succeed?
I tried paynerc's solution, but my name still is old name, doesn't changed.
😔

@tallytalwar
Copy link

tallytalwar commented Apr 28, 2017 via email

@meilbn
Copy link

meilbn commented Apr 28, 2017

Oh yeah!
Worked, first try I clicked verify link in my mail, seems failed, CocoaPods web site tell me I'm set up, but in terminal, run pod trunk me, print:

[!] Authentication token is invalid or unverified. Either verify it with the email that was sent or register a new session.

And second try is succeed.

Thanks, also thanks paynerc.

@orta
Copy link
Member

orta commented Apr 28, 2017

Great work @paynerc, interesting.

A quick look through the me command makes me think that we can't reasonably offer the ability to rename in this command. If you're using it to change your current login then sending auth for your current login seems pretty illogical.

I guess we'll need a new command for rename that is basically the same code but includes default_headers.

@paynerc
Copy link

paynerc commented Apr 28, 2017

@orta Yeah, it seems counterintuitive to have to have a valid session first and then create a new one just to change your name.

The only way I think changing the name on session registration would work is that for a name change, the new name is stored somewhere temporarily and only overwriting the previous name on the verify action.

@orta
Copy link
Member

orta commented Apr 28, 2017

I've shipped a PR adding the command pod trunk me rename NAME thanks to this research - thanks CocoaPods/cocoapods-trunk#92

@lyc2345
Copy link

lyc2345 commented May 11, 2017

pod trunk me rename 'NAME'
[!] Unknown command: rename
There is no this command. Is another workaround to change trunk name?

@innocarpe
Copy link

innocarpe commented Jun 28, 2017

@lyc2345 I changed my name using paynerc's solution. You should try it.

@sid-github
Copy link

Worked for me too, I had to "Confirm the session" twice for this to work, first time to get an auth token and second time to update the name.

@lilyball
Copy link

lilyball commented Apr 4, 2019

Can we please get this fixed? Looking at the code @paynerc cited, my impression is the problem is that it's trying to set the owner name at the point where you attempt the registration, not the point where you confirm the session. If so, that's the big problem. The "confirm your session" should use the name supplied during the registration but not actually save that to the database yet, and then actually confirming it should save the supplied name.

This also makes me wonder, if I pick an email address that hasn't been registered yet, attempt to register with a bogus name, but never confirm the session (because it's not my email), when the actual owner of that email goes to register for themselves, will they be stuck with the bogus name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.