Hash something unique.

I have implemented a custom verification in the system I am working on at
work.

In my signup action, this creates a super super unique key 32 length string
:) (this is overkill, but handles if two forms happen at the same
request.now)

signup_hash = hash("%s|%s|%s|%s|%s" % (member_id, first_name, last_name,
email, request.now))

127.0.0.1:8000/init/default/confirm/%s % signup_hash

def confirm():
    response.title = 'Confirmation'
    hash = request.args(0) or None

    success = False
    member = None

    if hash:
        member = db(db.participant.signup_hash == hash).select().first()

        if member:
            member['is_valid'] = True
            db.participant[member.id] = member
            success = True

    return dict(success=success, hash=hash, member=member)


and on your confirmation page, you know

{if hash:}}
    {{if success:}} you have been confirmed
    {{else:}} sorry could not find your account for some reason.
    {{pass}}

{{else:}}
thank you for registering, you should be recieving an email shortly
{{pass}}


-Thadeus




On Mon, Oct 12, 2009 at 11:43 AM, mattynoce <[email protected]> wrote:

>
> hi, i'm looking to email verification separate from the auth_user
> class. i know the concept but what i'd like to do is use the same
> function that auth uses to create its random string. is there a simple
> function i can call to return a long, quasi-random string?
>
> for example, i want to do something like:
> str = [get long string]
> message = 'Please click here:
> http://www.mysite.com/init/default/customverify/'
> + str
>
> is that function available?
>
> thank,
>
> matt
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to