Pedro, I agree with you and I think the router problem will not be an
issue anymore on Rails 3 router.
I just find it confusing to have 2 rules for usernames. If currently
Gitorious doesn't support usernames with dots and underscore, I don't
think it makes sense to allow it at all. But we could change that after
migrating to Rails 3.
I also think that dots are very common in usernames for ignoring it. And
I don't even understand the reason why underscore aren't allowed in the
first place...
Em 16-05-2011 11:07, Pedro Kiefer escreveu:
I think limiting user names so that it doesn't include dots or
underscore is not the best thing, specially if you take in account the
ldap branch that will be merged eventually. You don't want to make a
company adopting gitorious to change its username policy.
I know that adding the proper routing for all those different types of
urls is not easy, but limiting the username is not the best solution
on the long run.
Just my two cents on the subject.
On Mon, May 16, 2011 at 10:51 AM, Rodrigo Rosenfeld Rosas
<[email protected] <mailto:[email protected]>> wrote:
Em 16-05-2011 03:05, Christian Johansen escreveu:
It is not explained the reason why the rules are different
for new and existent users, but I guess the original format
was USERNAME_FORMAT, which allowed underscore (_) and dots
(.). Then, for some unknown reason to me, it has probably
changed for not allowing dots and underscore anymore,
probably for easing routes generation. The different rules
are probably explained because there was no obvious thing to
do with current users.
This is the exact reason. The "new" URL routing does not handle
dots in user names, so with it we restricted the pattern for user
names.
That is why you can use dots and underscore in existent users
but not for new users. We should think in some better
solution for this anyway...
Allowing dots in user names is too complicated in routing and
views. The better approach would probably be to "freeze" dotted
usernames - i.e. not allow any new ones, not even for existing
users. It would probably even make sense to force existing users
to update their user name when editing their profile because URLs
won't work for them anyway.
What could possible go wrong if we replaced the code below?
# For new users we are a little more strict than for existing ones.
USERNAME_FORMAT = /[a-z0-9\-_\.]+/i.freeze
USERNAME_FORMAT_ON_CREATE = /[a-z0-9\-]+/.freeze
...
validates_format_of :login, :with =>
/^#{USERNAME_FORMAT_ON_CREATE}$/i, :on => :create
validates_format_of :login, :with =>
/^#{USERNAME_FORMAT}$/i, :on => :update
with
USERNAME_FORMAT = /[a-z0-9\-]+/i.freeze # what used to be
USERNAME_FORMAT_ON_CREATE
validates_format_of :login, :with => /^#{USERNAME_FORMAT}$/i
Actually, I think the correct would be using \A and \Z. Maybe the
above would be simpler:
USERNAME_FORMAT = /\A[a-z0-9\-]+\Z/i.freeze
validates_format_of :login, :with => USERNAME_FORMAT
But this still allows some login like '---' or '007', while I'm
not sure it is ok to allow logins like that... Wow, how specifying
login rules is hard, don't you think? :)
What I mean is that I think the only way user.save (and thus
validate) could be called is by the user trying to update its own
profile, right? In this case, he or she will be forced to change
their login if they want to update their profile. We could than
state the reason in the message why they cannot keep their logins
and encourage them to change them.
Is it right?
Rodrigo.
Not sure how to proceed yet :)
Best regards,
Rodrigo.
Em 15-05-2011 18:42, William Ghelfi escreveu:
I followed this guide:
http://cjohansen.no/en/ruby/setting_up_gitorious_on_your_own_server
And specified user.login=w.trumbitta in the create admin
script, as showed in the guide
:)
Wiz
Il giorno 15/mag/2011 23:34, "Rodrigo Rosenfeld Rosas"
<[email protected] <mailto:[email protected]>> ha scritto:
> I still don't understand. Are you talking about
script/create_admin? If
> so, the scripts only asks for e-mail and password and not
about the login.
>
> How exactly did you get your login with a dot in it? Did
you do that
> directly in database, through SQL or some tool?
>
> Em 14-05-2011 14:39, William Ghelfi escreveu:
>>
>> Hi,
>> It happened with the very first user, created via console
during the
>> installation.
>> Login was w.trumbitta
>> User creation went fine, but then there were the
described problems.
>>
>> Maybe it's more a glitch than a real bug?
>>
>> Bau,
>> Wiz
>>
>> Il giorno 14/mag/2011 19:10, "Rodrigo Rosenfeld Rosas"
>> <[email protected] <mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>> ha
scritto:
>> > Em 12-05-2011 05:33, Wiz of Id escreveu:
>> >> production.log:
>> >>
>> ...
>> >> Read somewhere on the net that this happens to someone
when the
>> >> username has a . in it.
>> >> Given the reason is really that, what can I do to fix
the issue :) ?
>> >
>> > Hi Wiz,
>> >
>> > I tried to replicate your problem but Gitorious didn't
allowed me to
>> > create a username with a dot in it. How did you get that?
>> >
>> > Regards, Rodrigo.
>
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]