trunk.cocoapods.org icon indicating copy to clipboard operation
trunk.cocoapods.org copied to clipboard

Updating name doesn't work

Open f2prateek opened this issue 9 years ago โ€ข 30 comments

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 (https://github.com/CocoaPods/trunk.cocoapods.org/blob/e0be3b379138d154f8d3f4f7a2e7d9dd799970f4/app/models/owner.rb#L31-L38), but doesn't seem to be working with CocoaPods 0.39.0.

image

f2prateek avatar Nov 18 '15 23:11 f2prateek

Really weird, looking at https://github.com/CocoaPods/trunk.cocoapods.org/blob/master/app/controllers/api/sessions_controller.rb#L17 it should be working...

segiddins avatar Dec 08 '15 16:12 segiddins

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

f2prateek avatar Dec 08 '15 17:12 f2prateek

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

segiddins avatar Dec 08 '15 17:12 segiddins

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

chiulam avatar Jan 05 '16 03:01 chiulam

Might be related to https://github.com/CocoaPods/trunk.cocoapods.org/pull/150 ?

alloy avatar Jan 05 '16 10:01 alloy

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.

hohl avatar Mar 17 '16 13:03 hohl

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

ipavlidakis avatar Jun 20 '16 10:06 ipavlidakis

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

orta avatar Jun 21 '16 12:06 orta

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

lengain avatar Jul 25 '16 07:07 lengain

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.

meilbn avatar Oct 18 '16 08:10 meilbn

Anybody found a workaround for this issue?

katejaiheelee2 avatar Jan 24 '17 18:01 katejaiheelee2

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

tallytalwar avatar Feb 07 '17 18:02 tallytalwar

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.

lstemerdink avatar Feb 17 '17 12:02 lstemerdink

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

orta avatar Feb 17 '17 12:02 orta

Any news?

scinfu avatar Apr 06 '17 08:04 scinfu

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

orta avatar Apr 06 '17 08:04 orta

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>.

paynerc avatar Apr 27 '17 20:04 paynerc

@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

tallytalwar avatar Apr 27 '17 21:04 tallytalwar

@tallytalwar This command just print:

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

Is password is the Token?

Thanks!

meilbn avatar Apr 28 '17 01:04 meilbn

Yup password is the token

tallytalwar avatar Apr 28 '17 01:04 tallytalwar

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

meilbn avatar Apr 28 '17 01:04 meilbn

Yes it did work for me. Make sure to verify your session by clicking on the link which is mailed to you first.

On Apr 27, 2017 9:44 PM, "ๆˆ‘็š„็œผ้‡Œๅชๆœ‰ไปฃ็ " [email protected] wrote:

@tallytalwar https://github.com/tallytalwar Thanks! But...Are you changed your name succeed? I tried paynerc's solution, but my name still is old name, doesn't changed. ๐Ÿ˜”

โ€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/CocoaPods/trunk.cocoapods.org/issues/155#issuecomment-297884971, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWAwemoFNkzxWu9RHN7D1vgluQ94j9Jks5r0USJgaJpZM4GlIKQ .

tallytalwar avatar Apr 28 '17 01:04 tallytalwar

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.

meilbn avatar Apr 28 '17 01:04 meilbn

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.

orta avatar Apr 28 '17 08:04 orta

@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.

paynerc avatar Apr 28 '17 11:04 paynerc

I've shipped a PR adding the command pod trunk me rename NAME thanks to this research - thanks https://github.com/CocoaPods/cocoapods-trunk/pull/92

orta avatar Apr 28 '17 12:04 orta

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

lyc2345 avatar May 11 '17 10:05 lyc2345

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

innocarpe avatar Jun 28 '17 06:06 innocarpe

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.

sid-github avatar Jul 06 '17 21:07 sid-github

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?

lilyball avatar Apr 04 '19 18:04 lilyball