def login(auth=None): form = LoginForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data.lower().strip()).first() if user is not None and user.verify_password(form.password.data): login_user(user, form.remember_me.data) return redirect(request.args.get('next') or url_for('main.index')) flash('Invalid username or password') elif auth == 'github': return github.authorize(callback=url_for('auth.authorized', _external=True, auth="github")) return render_template('auth/login.html', form=form)
def login(auth=None): form = LoginForm() if form.validate_on_submit(): user = User.query.filter_by( email=form.email.data.lower().strip()).first() if user is not None and user.verify_password(form.password.data): login_user(user, form.remember_me.data) return redirect(request.args.get('next') or url_for('main.index')) flash('Invalid username or password') elif auth == 'github': return github.authorize( callback=url_for('auth.authorized', _external=True, auth="github")) return render_template('auth/login.html', form=form)
def setup_webhook(): pid = request.args.get("pid") if pid is None: abort(404) package = Package.query.get(pid) if package is None: abort(404) if not package.checkPerm(current_user, Permission.APPROVE_RELEASE): flash("Only trusted members can use webhooks", "danger") return redirect(package.getDetailsURL()) gh_user, gh_repo = package.getGitHubFullName() if gh_user is None or gh_repo is None: flash("Unable to get Github full name from repo address", "danger") return redirect(package.getDetailsURL()) if current_user.github_access_token is None: return github.authorize("write:repo_hook", redirect_uri=abs_url_for( "github.callback_webhook", pid=pid)) form = SetupWebhookForm(formdata=request.form) if form.validate_on_submit(): token = APIToken() token.name = "GitHub Webhook for " + package.title token.owner = current_user token.access_token = randomString(32) token.package = package event = form.event.data if event != "push" and event != "create": abort(500) if handleMakeWebhook(gh_user, gh_repo, package, current_user.github_access_token, event, token): flash("Successfully created webhook", "success") return redirect(package.getDetailsURL()) else: return redirect(url_for("github.setup_webhook", pid=package.id)) return render_template("github/setup_webhook.html", form=form, package=package)
def github_login(): if not app.config.get("GITHUB_OAUTH_ENABLE"): return abort(400) return github.authorize(callback=url_for("authorized", _external=True))
def authorize(): return github.authorize()
def login(): session['github_action'] = 'login' return github.authorize(scope='user:email')
def register(): session['github_action'] = 'register' return github.authorize(scope='user:email')
def github_auth(): return github.authorize( callback=url_for('oauth.github_oauth_handler', _external=True), next=request.args.get('next') or request.referrer )
def login(): return github.authorize(scope="user,repo,delete_repo")
def get(self): return github.authorize(scope = 'user,public_repo')
def github_auth(): return github.authorize(callback=url_for('oauth.github_oauth_handler', _external=True), next=request.args.get('next') or request.referrer)
def login(): return github.authorize()
def authorize(self): return github.authorize(url_for('oauth_callback', provider=self.provider_name, _external=True), _external=True)
def get(self): return github.authorize(scope='user,public_repo')
def authorize(): """ Authorizes user with defined scope. """ return github.authorize(scope=Config.scope)
def github_login(): if not app.config.get('GITHUB_OAUTH_ENABLE'): return abort(400) return github.authorize(callback=url_for('authorized', _external=True))
def start(): return github.authorize("", redirect_uri=abs_url_for("github.callback"))
def github_signin_page(): return github.authorize("")