def lastfm_reg(uid, user): token = request.args.get('token') if token in ('', None): flash('Missing LastFM auth token') return redirect(url_for('user_profile', uid = uid)) lfm = LastFm(app.config['LASTFM'], user, app.logger) status, error = lfm.link_account(token) store.commit() flash(error if not status else 'Successfully linked LastFM account') return redirect(url_for('user_profile', uid = uid))
def lastfm_reg(): token = request.args.get('token') if token in ('', None): flash('Missing LastFM auth token') return redirect(url_for('user_profile')) lfm = LastFm(UserManager.get(store, session.get('userid'))[1], app.logger) status, error = lfm.link_account(token) store.commit() flash(error if not status else 'Successfully linked LastFM account') return redirect(url_for('user_profile'))
def lastfm_reg(uid): token = request.args.get('token') if token in ('', None): flash('Missing LastFM auth token') return redirect(url_for('user_profile', uid = uid)) if uid == 'me': lfm = LastFm(UserManager.get(store, session.get('userid'))[1], app.logger) else: if not UserManager.get(store, session.get('userid'))[1].admin or not UserManager.get(store, uid)[0] is UserManager.SUCCESS: return redirect(url_for('index')) lfm = LastFm(UserManager.get(store, uid)[1], app.logger) status, error = lfm.link_account(token) store.commit() flash(error if not status else 'Successfully linked LastFM account') return redirect(url_for('user_profile', uid = uid))