Janrain: NEW OpenID connect

153 views
Skip to first unread message

Stefan van den Eertwegh

unread,
Apr 23, 2015, 12:00:34 PM4/23/15
to web...@googlegroups.com
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

Dmitry Ermolaev

unread,
Apr 25, 2015, 1:47:06 AM4/25/15
to web...@googlegroups.com
I use only email.registration
it simple - not logins not passwords!
example:

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 написал:

Rene Dohmen

unread,
Apr 30, 2015, 7:39:01 AM4/30/15
to web...@googlegroups.com
I have the same problem:
Gmail user can't login anymore. Google Apps for business user can login; but they get a popup telling them it will expire 20 april 2015.

R

Anthony

unread,
Apr 30, 2015, 8:09:33 AM4/30/15
to web...@googlegroups.com
You have to log into your Janrain dashboard and do the following:
  1. In the Providers box, click the Manage Providers icon. Select Google+ from the list on the right and go through the process of configuring it (you will have to take some steps on Google to complete the process).
  2. In the Widgets and SDKs box, click Sign-Ins. In the widget configuration tab, click Providers. Remove the old "Google" button and replace it with the "Google+" button (you may see a warning saying you are only allowed 6 providers, but this doesn't seem to matter). It may take an hour or so for the updated widget to appear on your site.

Anyone who previously logged in with a Google account will continue to be able to log in via the Google+ provider. Note, by default, users without a Google+ account will be prompted to create one. However, Janrain provides an option to disable that requirement (which you will be presented with during step 1 above).

Note, depending on your version of web2py, you might also need to update the web2py Janrain code. The latest file is /gluon/contrib/login_methods/janrain_account.py, but there is also an updated rpx_account.py for backward compatibility (if you don't want to change your import statement.

Anthony

Reply all
Reply to author
Forward
0 new messages