I use only email.registration
it simple - not logins not passwords!
example:
http://lite.cash/bets/man/greet
def set_session(sess, man):
sess.man_id = man.id
sess.man_name = man.name
# confirm - подтверждение по почте получено
def greet_conf():
key = request.args(0)
if not key: return dict(h = T('Empty key'))
rec = db(db.man_keys.temp_key == key).select().first()
if not rec: return dict(h = T('Key not found'))
man = db.men[ rec.man_id ]
del db.man_keys[ rec.id ]
if not man: return dict(h = T('Man not found'))
set_session(session, man)
#return dict(h = CAT(T('Welcome'),', ', man.name))
redirect(URL('default','index'))
def mail_greet(man, req):
from gluon.tools import Mail
import random
import string
key = ''.join(random.choice(string.ascii_uppercase +
string.ascii_lowercase + string.digits) for x in range(40))
# запомним ключ посланный - только его принимаем
db(db.man_keys.man_id == man.id ).delete()
db.man_keys.insert( man_id = man.id, temp_key = key )
url = URL('man', 'greet_conf', args=[key], scheme=True, host=True)
#context = dict( key = key, man = man.name, url = url )
#mess = response.render('man/email_greet.html', context)
mess = CAT(
H4(T('Hi'), ', ',man.name, '!'),
BR(),
T('You or someone request a re-greeting on %s') %
req.env.http_host, BR(),
#T('You or someone request a re-greeting on %s') %
'LITE.cash/bets', BR(),
T('If that not you simple ignore that letter.'),B(),
T('or'),BR(),
T('For restore your greet on our site click'), ' ',
A(H1(B(T('re-greeting url'))), _href=url),
)
h = CAT(P(T('A letter sent to [%s]. Check your email and spam (junk)
folder') % man.email))
if req.is_local:
h += DIV(mess)
else:
from gluon.tools import Mail
mail = Mail()
mail.settings.server = settings.email_server
mail.settings.sender = settings.email_sender
mail.settings.login = settings.email_login
mail.send(
to = man.email,
subject = T('Restore access to BETS'),
message = '<html>%s</html>' % mess )
return h
def greet():
res = ''
if session.man_id:
return dict( h = DIV(XML(T('Use %s menu first') % A(T('Forget Me'),
_href=URL('man', 'forget')))))
form = FORM(LABEL(T('Input Your Email')),
INPUT(_name='em', requires=IS_EMAIL()),
INPUT(_type='submit', _class='btn btn-' + CLRS.btn))
if form.accepts(request, session, keepvalues=True):
man = db(db.men.email == form.vars.em).select().first()
if man:
response.flash = 'Email with access key send to Your. Check
email and spam folder'
res = mail_greet(man, request)
else:
form.errors.em = 'That email not metting'
response.flash = T('That email not metting, please to Meet
first')
elif form.errors:
response.flash = ''
else:
response.flash = 'please fill the form'
h = DIV(T('For to restore Dating enter your email address and we will
send you the key'), '. ',
#T('If that email not known for as'), ' ',
#A(T('to Meet'), _href=URL('man','meet')), ' ', T('first.'),
form,
res,
_class='inv')
return dict( h = h )
def forget():
#return dict( h = (T('Sorry, email is busy')))
session.man_id = session.man_name = session.man = None
redirect(URL('man', 'meet'))
def form_accs_validate(f):
if db((db.man_accs.man_id == f.vars.man_id)
& (db.man_accs.cash_id == f.vars.cash_id)).select().first():
f.errors.cash_id = T('Aready exist')
response.flash = 'form has errors'
четверг, 23 апреля 2015 г., 19:00:34 UTC+3 пользователь Stefan van den
Eertwegh написал:
>
> Dear fellow web2py users,
>
> I understand that the Janrain plugin in web2py makes use of openID for
> Google Accounts authorization.
> Now at the moment we get a warning from the authorization site that google
> doesn't use OpenID anymore and therefore we need to use OpenID Connect.
>
> Is this a change in the web2py codebase that needs to happen or is Janrain
> self supplying web2py with the new way for google Open ID connect
> authorization way?
>
> If anyone knows the answer, i would really appreciate it.
>
> Thanks.
>
> Best regards,
> Stefan van den Eertwegh
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.